wcf
wcf copied to clipboard
TargetFramework logic insufficient for .NET 5
With .NET 5 we are introducing a new style of target framework that includes target platform information (for example, net5.0-windows). This repo contains logic that will break with these new target framework and duplicated target framework logic.
Details:
- https://github.com/dotnet/wcf/blob/master/eng/TargetFramework.props#L5: TargetFrameworkIdentifier and TargetFrameworkVersion properties are defined by the SDK and should be used directly. If that is impossible, these MSBuild functions can be used to parse: https://github.com/dotnet/msbuild/issues/5171#issuecomment-597422462
- https://github.com/dotnet/wcf/blob/master/eng/TargetFramework.props#L16: this section seems to be trying to parse target platform information out of the target framework, which is a supported scenario with .NET 5 and will likely conflict with the new default logic.
- https://github.com/dotnet/wcf/blob/master/eng/TargetFramework.props: I don't have context on this file, but there is a lot of code that looks suspicious and likely will break with .NET 5. For example, this condition seems to be looking for platforms in the target framework identifier.
- https://github.com/dotnet/wcf/blob/master/src/dotnet-svcutil/lib/src/Shared/TargetFrameworkHelper.cs: I don't see any issues that jump out in this file, but it should probably be audited by someone who understands the context better. It is also possible that some of the logic here surrounding supported target frameworks is duplicated and could be replaced with NuGet API calls.
cc @mconnew
This is probably fine because WCF has not been updated to .NET 5.0, we are still staying on .NET 3.0.
it definetly doesn't work

Even setting --targetFramework doesn't work

Problem is that it picks the targetframework moniker from csproj file regardless it seems. Doing the same outside of the project works, but something is not right here

@imcarolwang can you please take a look at this issue?
This also impacts the new .NET6 based Xamarin projects which use net6.0-android and net6.0-ios TFMs.
A workaround is to temporarily change the TFM in the project to net6.0, run dotnet-svcutil and then change it back.
@imcarolwang, can you please verify whether these new versions are already included?
In PR #4650 we added support of net5.0-* and net6.0-* targets, the code has been merged so the next release of dotnet-svcutil and WCF Connected Service tool should support project types such as net6.0-android , net6.0-ios, net6.0-windows.
@imcarolwang the code hardcodes net5.0 and net6.0 though so it'll break again on net7.0: https://github.com/dotnet/wcf/blob/88c3d3959b19d21df7699edae09eed1ec15b8e09/src/dotnet-svcutil/lib/src/Shared/MSBuildProj.cs#L163
@imcarolwang the code hardcodes net5.0 and net6.0 though so it'll break again on net7.0:
https://github.com/dotnet/wcf/blob/88c3d3959b19d21df7699edae09eed1ec15b8e09/src/dotnet-svcutil/lib/src/Shared/MSBuildProj.cs#L163
Address in PR https://github.com/dotnet/wcf/pull/4893 which is under review.
Fix is in and released to dotnet-svcutil version 2.1.0. Closing issue.