@@ -226,13 +226,21 @@ type internal FSharpProjectOptionsManager
226226
227227    [<Export>] 
228228    /// This handles commandline change notifications from the Dotnet Project-system 
229+      /// Prior to VS 15.7 path contained path to project file, post 15.7 contains target binpath 
230+      /// binpath is more accurate because a project file can have multiple in memory projects based on configuration 
229231     member  this.HandleCommandLineChanges ( path : string ,  sources : ImmutableArray < CommandLineSourceFile >,  references : ImmutableArray < CommandLineReference >,  options : ImmutableArray < string >)  = 
232+         let  projectId  = 
233+             match  workspace.ProjectTracker.TryGetProjectByBinPath( path)  with 
234+             |  true ,  project ->  project.Id
235+             |  false ,  _  ->  workspace.ProjectTracker.GetOrCreateProjectIdForPath( path,  projectDisplayNameOf path) 
236+         let  project  =   workspace.ProjectTracker.GetProject( projectId) 
237+         let  path  =  project.ProjectFilePath
230238        let  fullPath  p  = 
231-             if  Path.IsPathRooted( p)  then  p
239+             if  Path.IsPathRooted( p)  ||  path  =   null   then  p
232240            else  Path.Combine( Path.GetDirectoryName( path),  p) 
233241        let  sourcePaths  =  sources |>  Seq.map( fun  s  ->  fullPath s.Path)  |>  Seq.toArray
234242        let  referencePaths  =  references |>  Seq.map( fun  r  ->  fullPath r.Reference)  |>  Seq.toArray
235-          let   projectId   =  workspace.ProjectTracker.GetOrCreateProjectIdForPath ( path ,  projectDisplayNameOf path ) 
243+ 
236244        projectOptionsTable.SetOptionsWithProjectId( projectId,  sourcePaths,  referencePaths,  options.ToArray()) 
237245        this.UpdateProjectInfoWithProjectId( projectId,  " HandleCommandLineChanges" ,  invalidateConfig= true ) 
238246
0 commit comments