Closed baruchiro closed 5 years ago
I see code like this: https://github.com/Microsoft/MSBuildLocator/blob/9c3c8dc23677041b6a23919b14a495dcdd5d7c8d/src/MSBuildLocator/MSBuildLocator.cs#L308-L323
It seems like when we compile with .Net Core we assume that there is no Visual Studio? Or that we don't need to search him?
For my case, I actualy need the Visual Studio when I compile to .Net Core.
And if I remove the netcoreapp2.0
from TargetFrameworks
in the Microsoft.Build.Locator.csproj
, and run the BuilderApp
with only netcoreapp
, it identifies the VS.
What version of MSBuildLocator are you using?
You can't use Visual Studio MSBuild from a .NET Core app; the core MSBuild implementation is very similar but tasks and targets differ--there's no guarantee that a project that works in VS will even load in Core, much less build.
Do you plan to add .net core
support?
Support for finding and using MSBuild from a .NET Core SDK in a .NET Core application was added in #51.
We don't plan to have any kind of support for finding and using MSBuild from a Visual Studio instance in a .NET Core application.
Too bad.
I try every possible way to find a way to work with project files (.*proj
).
@rainersigwald Ok, so VS 2022 still creates a project targeting net472 when I choose "Stand-Alone Code Analysis Tool" template. I would like to switch the project to net6.0, what is the suggestion?
I try to load a
Microsoft.Build.Evaluation.Project
in my project. When I compile my project innetcoreapp2.1
theProject
didn't loading because MSBuild not loaded.The code
var vsInstances = MSBuildLocator.QueryVisualStudioInstances();
return one instance when it compiled tonet471
, but return 0 instances when it compiled tonetcoreapp2.1
.Maybe it related to #21 or #30, I didn't know. I'm still getting to know the working way and MSBuild's special cases.