I am trying to upgrade my project to support .NET 5 while still building on a .NET Core 3.1 toolset.
I tried to add the .NET 5 TFM (.net5.0
) to my target frameworks like so.
<TargetFrameworks>netcoreapp3.0;netcoreapp3.1;net5.0</TargetFrameworks>
Unfortunately, this causes the build to fail when running on a machine with only .NET Core 3.1 toolset installed.
error MSB3971: The reference assemblies for ".NETFramework,Version=v5.0" were not found. You might be using an older .NET SDK to target .NET 5.0 or higher. Update Visual Studio and/or your .NET SDK.
I'm trying to find a condition so I can target net5.0
only if it is available, but documentation is sparse.