dotnet / dotnet/wcf

The dotnet-svcutil tool does not resolve the value of the TargetFramework property when it contains other MSBuild properties.

Open
#5,427 3 comments 0 reactions 1 assignee Claimed by @imcarolwang View on GitHub
triaged
Dominant language
C#
Stars
1.8k
Forks
576
Avg merge
6d 9h
Merged PRs (30d)
2

Description

**Describe the bug**
When using the `dotnet-svcutil` tool from a C# SDK-style project and the project has `$(LibTargetFramework)`, the `dotnet-svcutil` tool will fail with a message about `$(LibTargetFramework)` not being a supported target framework even though the LibTargetFramework property resolves to `netstandard2.0`.

`The target framework '$(libtargetframework)' is not a supported .NET Core, .NET Standard, or a .NET Framework version. The minimum supported framework versions are as follows: netcoreapp1.0, netstandard1.3 and net4.5.`

`The command "dotnet tool run dotnet-svcutil "WSDL\Repro.wsdl" -tf "netstandard2.0" -n "*,Repro.Proxy.Generated" -o ".generated\ReproProxy.cs" -v Verbose" exited with code 2.`

I am using dotnet-svcutil 2.1.0 when encountering this error. If I change the TargetFramework property in the project file to be `netstandard2.0` rather than using a property, it works.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a C# SDK-style library project for .NET Standard 2.0.
2. Add a Directory.Build.props file and defined a property: `netstandard2.0`
3. Update the csproj to set: `$(LibTargetFramework)`
4. Add a custom target to invoke the dotnet-svcutil tool before the `Build` target.

See attached [TestDotNetSvcUtilLib_CSProj.zip](https://github.com/dotnet/wcf/files/14315448/TestDotNetSvcUtilLib_CSProj.zip).

**Expected behavior**
The TargetFramework property should be resolved correctly.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.