terrafx / terrafx.interop.windows

Interop bindings for Windows.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] fresh build looks for .NET CORE 5.0

IngmarBitter opened this issue · comments

Windows 10 Pro, Visual Studio 2019, .NET CORE 3.0 and 3.1 installed via the Visual Studio installer.
terrafx repo cloned, opened TerraFX.Interop.Windows.sln tried to run TerraFX.Samples.DirectX in Debug AnyCpu mode.

I got 117 identical errors complaining that

The current .NET SDK does not support targeting .NET Core 5.0. Either target .NET Core 3.1 or lower, or use a version of the .NET SDK that supports .NET Core 5.0.

All pointing back to the file

C:\ProgramFiles\dotnet\sdk\3.1.201\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets

Why is it thinking .Net Core 5.0 is configured as target?

PS: Ok, the next version of .Net Core will be .Net 5.0 (no core). I installed the preview 3 and rebuilt the solutino. Still same error.

You need to install .NET 5.0 preview 3 (or newer) and likely use VS 2019 Preview, as well. Tanner's multitargeting the projects now.

Ok, the next version of .Net Core will be .Net 5.0 (no core). I installed the preview 3 and rebuilt the solutino. Still same error.

Perhaps the TFM change was breaking after all? Didn’t expect that. In any case, it probably should be changed from netcoreapp5.0 to net5.0 and such change may fix this issue

For .NET 5 you will eventually need VS 2019 Preview. However, for the current preview you should be able to get it working by enabling VS to use preview SDKs.

If you goto Tools->Options->Environemtn->Preview Features you'll find a checkbox for Use previews of the .NET Core SDK (requires restart) which should unblock you for now:
image

Yay! Got it to work. So the preview of .Net 5.0 is needed, but the normal released version of VisualStudio 2019 is fine - although only after checking the feature Tools->Options->Environment->Preview Features->Use previews of the .Net Core SDK.

Thanks for you quick responses and help.
Should this info be added to the readme here at the root of the repo?
https://github.com/terrafx/terrafx.interop.windows

From my point of view this issue can be closed. Am I supposed to do so or someone else?

Feel free to submit a PR.

I've closed it, although you should feel free to do so in the future if you feel your issue is resolved or no longer applicable.

I've logged #48 to track updating the documentation to call out any tooling requirements.