Reputation: 365
I have just upgraded .NET Core 3 RC1 to final (released two days ago), and then, as I just upgraded it, I could build projects and everything just fine. dotnet
command shows 3.0.100 version is the active SDK.
Then, I went away for a couple hours and when I was back working on VS2019 Community, it no longer worked, I simply couldn't build the project anymore. I was receiving the message:
The current .NET SDK does not support targeting .NET Core 3.0.
I'm tearing my hair apart with that!!! If I try from command line, I'm also having issues:
Solution file error MSB4249: Unable to build website project "demo1". The ASP.NET compiler is only available on the .NET Framework version of MSBuild.
dotnet --version
shows: 3.0.100
dotnet --list-sdks
shows in last line: 3.0.100 [C:\Program Files\dotnet\sdk]
So why the heck 3 RC1 was just working, upgraded; working; then. poof, not working? Tried repairing, uninstalling and reinstalling (Net Core 3 SDK), for no avail.
Edit: As suggested in my comments, here's the Visual Studio 2019 version where the issue was reproducible: 16.2.5. I believe this was the key to the issue, and I left unspoken.
Upvotes: 2
Views: 1012
Reputation: 131364
The Visual Studio version that works with the release version of .NET Core 3 is Visual Studio 2019 16.3.
As for the error itself, it's probably caused by the MSBuild environment variables registered by the older Visual Studio. VS and .NET Core SDK have their toolset copies and mixing them up leads to such problems. .NET Core 3.0 RC1 was released to avoid having different tools between the last VS and SDK previews. As the blog explains:
For technical and historical reasons, the .NET toolset (compilers, NuGet client, MSBuild, …) is duplicated between Visual Studio and the .NET Core SDK. Important changes were made in the toolset as part of Visual Studio 2019 16.3 Preview 4, also released today. It is critical that the .NET Core SDK version that is part of any Visual Studio release includes the same toolset in order to deliver a compatible experience in all scenarios.
Upvotes: 2