Skip to content

Commit eb98c27

Browse files
committed
Use LaunchProfiles capability detection rather than just CPS
Not all CPS projects support launch profiles
1 parent a0be632 commit eb98c27

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

SmartCmdArgs/SmartCmdArgs.Shared/CmdArgsPackage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public List<string> GetLaunchProfiles(Guid projGuid)
265265
var project = vsHelper.HierarchyForProjectGuid(projGuid);
266266

267267
List<string> launchProfiles = null;
268-
if (project?.IsCpsProject() == true)
268+
if (project?.SupportsLaunchProfiles() == true)
269269
{
270270
launchProfiles = cpsProjectConfigService.GetLaunchProfileNames(project.GetProject())?.ToList();
271271
}

SmartCmdArgs/SmartCmdArgs.Shared/Services/ItemAggregationService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ private TResult AggregateComamndLineItemsForProject<TResult>(IVsHierarchyWrapper
5353
string projPlatform = projectObj?.ConfigurationManager?.ActiveConfiguration?.PlatformName;
5454

5555
string activeLaunchProfile = null;
56-
if (project.IsCpsProject())
56+
if (project.SupportsLaunchProfiles())
5757
activeLaunchProfile = cpsProjectConfigService.GetActiveLaunchProfileName(projectObj);
5858

5959
TResult JoinContainer(CmdContainer con)

SmartCmdArgs/SmartCmdArgs.Shared/Services/OptionsSettingsEventHandlingService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private void UseSolutionDirChanged()
126126
}
127127
private void UseCpsVirtualProfileChanged()
128128
{
129-
foreach (var project in vsHelper.GetSupportedProjects().Where(x => x.IsCpsProject()))
129+
foreach (var project in vsHelper.GetSupportedProjects().Where(x => x.SupportsLaunchProfiles()))
130130
{
131131
projectConfigService.UpdateProjectConfig(project);
132132
cpsProjectConfigService.SetActiveLaunchProfileToVirtualProfile(project.GetProject());

SmartCmdArgs/SmartCmdArgs.Shared/Services/ProjectConfigService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ public bool IsSupportedProject(IVsHierarchyWrapper project)
733733

734734
private bool TryGetProjectConfigHandlers(IVsHierarchyWrapper project, out ProjectConfigHandlers handler)
735735
{
736-
if (project.IsCpsProject())
736+
if (project.SupportsLaunchProfiles())
737737
{
738738
handler = cpsProjectConfigHandlers;
739739
return true;

SmartCmdArgs/SmartCmdArgs.Shared/Services/VisualStudioHelperService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public ProjectState(IVsHierarchyWrapper pHierarchy, ICpsProjectConfigService cps
129129
ProjectName = pHierarchy.GetName();
130130
IsLoaded = pHierarchy.IsLoaded();
131131

132-
if (pHierarchy.IsCpsProject())
132+
if (pHierarchy.SupportsLaunchProfiles())
133133
_launchSettingsChangeListenerDisposable = cpsProjectConfigService.ListenToLaunchProfileChanges(pHierarchy.GetProject(), launchProfileChangeAction);
134134
}
135135

SmartCmdArgs/SmartCmdArgs.Shared/Wrapper/IVsHierarchyWrapper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public interface IVsHierarchyWrapper
2323
string GetName();
2424
Project GetProject();
2525
string GetProjectDir();
26-
bool IsCpsProject();
26+
bool SupportsLaunchProfiles();
2727
bool IsSharedAssetsProject();
2828
bool IsLoaded();
2929
bool TryGetIconMoniker(out ImageMoniker iconMoniker);
@@ -81,9 +81,9 @@ public Project GetProject()
8181
/// see: https://github.com/dotnet/project-system
8282
/// see: https://github.com/Microsoft/VSProjectSystem/blob/master/doc/automation/detect_whether_a_project_is_a_CPS_project.md
8383
/// </summary>
84-
public bool IsCpsProject()
84+
public bool SupportsLaunchProfiles()
8585
{
86-
return hierarchy.IsCapabilityMatch("CPS");
86+
return hierarchy.IsCapabilityMatch("LaunchProfiles"); // https://github.com/Microsoft/VSProjectSystem/blob/master/doc/overview/project_capabilities.md not all cps projects support profiles https://github.com/microsoft/service-fabric-issues/issues/1095
8787
}
8888

8989
public bool IsSharedAssetsProject()

0 commit comments

Comments
 (0)