Open vsfeedback opened 3 months ago
Found same issue after upgrade. Also needed to process .net 7 projects but fails:
File: MSBuildProjectLoader.cs Class: Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.worker Method: LoadProjectFileInfosAsync
'buildHost' gets null value:
RemoteBuildHost buildHost = (await _buildHostProcessManager.GetBuildHostAsync(projectPath2, cancellationToken..)).Item1;
@JoeRobich do you have any ideas here while @jasonmalinowski is oof?
-- Cyrus
TIL I learned we shipped Workspaces.MSBuild in VS. Seems like a setup authoring issue with the managed languages VS component. We are only shipping one version of the BuildHost and in the wrong folder.
Hi, any news on this issue ?
extensions on VS 17.9 and 17.10 preview are unable to use MSBuildWorkspace
Hi everybody,
is there any workaround available to mitigate this issue (e.g. copying required exe and ddls into the "right" directory"?). At the moment I am stuck. Thank you very much! Thomas
Hello @CyrusNajmabadi,
it seems that the contentFiles
added in Microsoft.CodeAnalysis.Workspaces.MSBuild
v4.9 by https://github.com/dotnet/roslyn/pull/70469 is not correctly shipped by the VS installer.
The nuget Microsoft.CodeAnalysis.Workspaces.MSBuild @ 4.9.0-3.final
is deployed in C:\Program Files\Microsoft Visual Studio\2022\Professional\Common7\IDE\CommonExtensions\Microsoft\VBCSharp\LanguageServices but the contentFiles is missing. If I manually copy the folder BuildHost-net472 and BuildHost-netcore from the nuget to the VS installation folder my extension works fine.
Can anyone investigate why the contentFiles is missing or maybe transfert the issue to the VS team ? Thanks
Bonjour je rencontrais le même problème que vous avec vs2022 (17.10.1) mon ancien code _solution.GetSolutionInfo(out string solutionDirectory, out string solutionFile, out string solutionOptions);
/ using (var workspace = Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.Create()) { JoinableTaskFactory.Run(async delegate { _roslynSolution = await workspace.OpenSolutionAsync(solutionFile); }); } /
mon nouveau code
var componentModel = (IComponentModel)Microsoft.VisualStudio.Shell.Package.GetGlobalService(typeof(SComponentModel));
var WSworkspace = componentModel.GetService
_roslynSolution = WSworkspace.CurrentSolution;
en esperant que cela puisse vous débloquer aussi
Cdt Eric
@erchauvet Thanks for providing your code snippet. It solves my problem :-)
So for folks who are trying to use MSBuildWorkspace to analyze the currently open solution -- you should not be using MSBuildWorkspace in that situation -- @erchauvet's code snippet is what you should be doing the VisualStudioWorkspace represents the current open solution, and will be vastly faster to use, since that's the same snapshot we're driving many features with.
If you're using it to analyze some other solution, then we'll still get this fixed, but this hopefully gets you in the right direction in a lot of cases.
This issue has been moved from a ticket on Developer Community.
[severity:It’s more difficult to complete my work]
I have an exception in VS 2022 after fresh update from 17.7.1 to 17.9.2. The exception is thrown in my VS add-on by execute following code
System.AggregateException: One or more errors occurred. —> System.InvalidOperationException: Unable to locate the .NET Framework build host at c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\vbcsharp\languageservices\BuildHost-net472\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe - line 206d__8.MoveNext()d__7.MoveNext()d__20.MoveNext()d__21.MoveNext()d__19.MoveNext()d__22.MoveNext()d__22.MoveNext()d__24.MoveNext()d__8.MoveNext()d__7.MoveNext()d__20.MoveNext()d__21.MoveNext()d__19.MoveNext()d__22.MoveNext()d__22.MoveNext()d__24.MoveNext()<—
at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber)
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.GetPathToDotNetFrameworkBuildHost()
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.CreateDotNetFrameworkBuildHostStartInfo()
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.
— End of inner exception stack trace —
at System.Threading.Tasks.Task
1.GetResultCore(Boolean waitCompletionNotification) at CallsLogger.ExceptionWrapper.ChangeSources(AsyncPackage package, Func
3 action)—> (Inner Exception #0) System.InvalidOperationException: Unable to locate the .NET Framework build host at c:\program files\microsoft visual studio\2022\enterprise\common7\ide\commonextensions\microsoft\vbcsharp\languageservices\BuildHost-net472\Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost.exe - line 206
at Roslyn.Utilities.Contract.Fail(String message, Int32 lineNumber)
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.GetPathToDotNetFrameworkBuildHost()
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.CreateDotNetFrameworkBuildHostStartInfo()
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.BuildHostProcessManager.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.Worker.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.
— End of stack trace from previous location where exception was thrown —
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.
Original Comments
Feedback Bot on 3/4/2024, 09:19 PM:
(private comment, text removed)
Original Solutions
(no solutions)