Closed wherewhere closed 7 months ago
This should be fixed by #218 with the following exceptions:
Client
profile does not exist for .NET 2.0, so I did not add it.5.0
, the canonical form has no periods i.e. net481
, not net4.8.1
. The latter form is now valid but is not widely used.netcore50
is equivalent to uap10.0
and the latter is preferrednative
is a TFM you can build against, it's for NuGet packages that contain native assets?netcore50
is not equal to uap10.0
. It is a pure .NET platform without WinRT supports. You can build a netcore50
console app and it will running on .NET Framework. The moniker of netcore50
is .NETCore, Version=5.0
and uap10.0
is UAP, Version=10.0
Both netcore
and uap
are not supported by MSBuild SDK in default. It need to set by yourself. https://github.com/SharpAdb/AdvancedSharpAdbClient/blob/main/Directory.Build.props#L38-L62
.NET/WinRT for C++ projects should target to native
. https://github.com/CommunityToolkit/WindowsCommunityToolkit/blob/main/Microsoft.Toolkit.Uwp.Notifications/Microsoft.Toolkit.Uwp.Notifications.csproj#L19-L39
I did add netcore50
as a separate TFM shortname so that the editor can represent it in the form it was specified 🙂 https://github.com/mhutch/MonoDevelop.MSBuildEditor/pull/218/files#diff-f6022ed4ae947a7d938bee206bef2e5c20afd3f6a32a4b69e2aaffcc3cba1b2aR244
However, note that the docs https://learn.microsoft.com/en-us/dotnet/standard/frameworks describe some frameworks as equivalent, and some as deprecated in favor of equivalent frameworks.
Some of this equivalency is built into NuGet. For example, the short TFM win8
las the long form Windows,Version=v8.0
, and the short TFM netcore45
has the long form .NETCore,Version=v4.5
. However, NuGet considers them to be equivalent even though they are not identical: https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Frameworks/DefaultFrameworkMappings.cs#L129
The case of uap0.0
and netcore50
is an outlier as the docs say they are equivalent but NuGet does not. I'm not sure if this is intentional.
Anyways, the editor doesn't currently have any special behavior for equivalent TFMs, and treats them independently. It might be nice to have some kind of tooltip for equivalency and aliases, but I guess that will require more thought.
Regarding treatment of native
, I don't want to build in behavior without having a good definition of what it should mean outside of a NuGet package.
The link you provide for native
isn't internally consistent. For NuGet restore, these targets leave native
a native
(i.e. native,Version=v0.0
) or treat it as an alias for uap10.0
depending on whether it's a design-time build or not:
<NuGetTargetMoniker Condition="'$(DesignTimeBuild)' == 'true'">native</NuGetTargetMoniker>
<NuGetTargetMoniker Condition="'$(DesignTimeBuild)' != 'true'">UAP,Version=v10.0</NuGetTargetMoniker>
But for all other purposes, e.g. reference assembly pack resolution, it treats native
an alias for .UAP,Version=v10.0.19041.0
, then immediately overrides it to .NETCore,Version=v5.0
instead:
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>
...
<TargetPlatformVersion>10.0.19041.0</TargetPlatformVersion>
...
<TargetFrameworkIdentifier>.NETCore</TargetFrameworkIdentifier>
<TargetFrameworkVersion>v5.0</TargetFrameworkVersion>
In future I'd like to move away from hardcoding the TFMs in MSBuild Editor like this, and instead allow TFMs to be defined in the .buildschema.json
MSBuild schema files for the targets files that support/handle those TFMs. This would allow targets like these to define whatever TFMs they need without affecting completion/validation for projects that don't use those targets.
netcore50
is really different from uap10.0
. It has some references differents.
https://github.com/SharpAdb/AdvancedSharpAdbClient/blob/main/AdvancedSharpAdbClient/AdvancedSharpAdbClient.csproj#L88-L104
netcore50
can not reference to Microsoft.NETCore.UniversalWindowsPlatform
. It will throw error:
error NU1202: 包 System.Numerics.Vectors.WindowsRuntime 4.0.1 与 netcore50 (.NETCore,Version=v5.0) 不兼容。 包 System.Numerics.Vectors.WindowsRuntime 4.0.1 支持: uap10.0 (UAP,Version=v10.0)
NETCoreTest.zip And is that any way to write comments in MSBuild XML? Just like comments in C# and other languages. I don't want to write comments in new files...
And how about this pr #219
It recognizes net20 but not recognizes net2.0. And this And more...