Issue
If a customer created a net 5 app or got one from a coworker, opens it in 16.7, we have a bad error experience today as we decide it must be a framework application.
https://github.com/dotnet/core/issues/5311
We don鈥檛 recognize the TFM so we assume it鈥檚 a .net framework version and the message matches that.
Proposal
Update MSBuild 16.7 with a new message in this specific scenario in the below code path.
@RainerSigwald, any concerns just adding a check here for if the version is >= to 5.0 and providing a different error? That seems like the narrowest way to solve this with the least risk. I wouldn鈥檛 bother with 16.4.
https://github.com/dotnet/msbuild/blob/29665241066669d6c59f931faabf94a555bcce85/src/Tasks/GetReferenceAssemblyPaths.cs#L249
Other questions
@BenVillalobos mind prepping a 16.7 fix for this? No rush as we have a week or so before they lock down. Talk to Kathleen about the specific message to show and talk to Rainer about the app types he's concerned about. Test 5.0-windows.
Sure. What is the expected value of frameworkmoniker.Identifier when we're on net5.0? Is it net or netcoreapp?
Created PR for the rest of the discussion here: https://github.com/dotnet/msbuild/pull/5826
@marcpopMSFT Targeting net5.0-windows results in an SDK error:
"C:\src\repros\5820-16.7-errormsg\5820-16.7-errormsg.csproj" (default target) (1) ->
(_CheckForUnsupportedTargetFramework target) ->
C:\Program Files\dotnet\sdk\3.1.403\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(93
,5): error NETSDK1013: The TargetFramework value 'net5.0-windows' was not recognized. It may be misspelled. If not, th
en the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly. [C:\src\repros
\5820-16.7-errormsg\5820-16.7-errormsg.csproj]
That seems like a reasonable message. I don't think we want to try to special case every possible targetframework that we don't recognize. @KathleenDollard as an FYI.
Any reason this is still open?
@Forgind I'll keep this open until we also merge into 16.8
May want to test if this makes sense in 16.8 as it may not apply after 16.7.
Still gives an error on msbuild version 16.8.2+25e4d540b. Is there any workaround?
@mc0re do you have a global.json file that's lowering the sdk you use while targeting your app to net5.0?
The error gone away after updating to 16.9.2. Now I have other problems, but they are more click-once related :-)