Closed fjoppe closed 3 years ago
It's not possible to load the Visual Studio copy of MSBuild (which runs on .NET Framework) from a client application that runs on .NET 5 or .NET Core.
You have two options:
msbuild.exe
experience).dotnet build
experience).If the object of analysis is not using the .NET (Core) SDK, only option 1 will work for you. MSBuild (as part of the .NET Core SDK) can't load older projects.
Thanks for responding. I can confirm what you are saying. As I'm trying to create an analyzer which plows through the full code-base of an organization, changing the target framework from the analyzed-project is not an option. I'll stick with option 1.
Hi,
I'm trying to analyze C# code with Roslyn. This fails because
MSBuildLocator.QueryVisualStudioInstances()
returns incorrect values - for what I need.I am using
F#
in VS Code, with .net5-preview options, because these preview options have bad performance in Visual Studio Community 2019.This is #fsharp script (with preview options):
The last line produces this result in VS Code (with plugin "Ionide"):
While the same script in Visual Studio Community 2019, the last line produces:
I would like the same results in both environments, or at least the Visual Studio Community 2019 results in VS Code. It's the Visual Studio results which enable me to work with the Roslyn library. Because the object of analysis is still on one of the old .Net frameworks, while my analyzer works in .net5.
I also tried with QueryOptions, but this has no results. I understand from the source code, somewhere a call is made to an external imported dll. But I don't know how to manipulate this.