88using System . Linq ;
99using System . Threading . Tasks . Dataflow ;
1010
11+ // This isolation of Microsoft.VisualStudio.ProjectSystem dependencies into one file ensures compatibility
12+ // across various Visual Studio installations. This is crucial because not all Visual Studio workloads
13+ // include the ManagedProjectSystem extension by default. For instance, installing Visual Studio with only
14+ // the C++ workload does not install this extension, whereas it's included with the .NET workload at
15+ // "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Microsoft\ManagedProjectSystem".
16+ // One might consider adding the Microsoft.VisualStudio.ProjectSystem assembly to the VSIX. However, this approach fails due to
17+ // Visual Studio's configuration file (located at "%userprofile%\AppData\Local\Microsoft\VisualStudio\17.0_xxxxxxxx\devenv.exe.config")
18+ // specifying a binding redirect for Microsoft.VisualStudio.ProjectSystem.Managed to the latest version.
19+ // As such, ensuring compatibility requires knowledge of the version Visual Studio redirects to, which varies
20+ // by Visual Studio installation version.
21+
1122namespace SmartCmdArgs . Helper
1223{
1324 public static class CpsProjectSupport
@@ -64,7 +75,7 @@ public static IEnumerable<string> GetLaunchProfileNames(EnvDTE.Project project)
6475 return null ;
6576 }
6677
67- public static IDisposable ListenToLaunchProfileChanges ( EnvDTE . Project project , Action < ILaunchSettings > listener )
78+ public static IDisposable ListenToLaunchProfileChanges ( EnvDTE . Project project , Action listener )
6879 {
6980 if ( TryGetProjectServices ( project , out IUnconfiguredProjectServices unconfiguredProjectServices , out IProjectServices projectServices ) )
7081 {
@@ -74,7 +85,7 @@ public static IDisposable ListenToLaunchProfileChanges(EnvDTE.Project project, A
7485 return null ;
7586
7687 return launchSettingsProvider . SourceBlock . LinkTo (
77- new ActionBlock < ILaunchSettings > ( listener ) ,
88+ new ActionBlock < ILaunchSettings > ( _ => listener ( ) ) ,
7889 new DataflowLinkOptions { PropagateCompletion = true } ) ;
7990 }
8091
0 commit comments