Skip to content

svcutil dosen't work with .NET6 #4766

Closed
@zTGross

Description

@zTGross

After installing the new Visual Studio 2022 with its .NET 6 features the dotnet-svcutils tools doesen't work anymore.

What i did:

dotnet-svcutil.exe https://myDomain.org/MyService?wsdl --outputFile SvcClient.cs --targetFramework netstandard2.0 --serializer XmlSerializer --namespace *,My.Service --enableDataBinding

Output before updating the svc-util:

Microsoft (R) WCF Service Model Proxy Generation Tool for .Net Core platform
[Microsoft.Tools.ServiceModel.Svcutil, Version 2.0.1]
Copyright (c) Microsoft Corporation.  All rights reserved.

This tool collects information about how it is used in order to improve the tool. This functionality can be disabled by setting the environment variable "DOTNET_SVCUTIL_TELEMETRY_OPTOUT" to 1.

Resolving project references ...
Bootstrapping application ...
Error: Microsoft (R) Build Engine version 17.0.0+c9eb9dd64 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\myself\AppData\Local\Temp\dotnet-svcutil-lib_Temp\2021_Nov_12_14_32_32\SvcutilBootstrapper\SvcutilBootstrapper.csproj]
CSC : error CS8630: Invalid 'nullable' value: 'Enable' for C# 7.3. Please use language version '8.0' or greater. [C:\Users\myself\AppData\Local\Temp\dotnet-svcutil-lib_Temp\2021_Nov_12_14_32_32\SvcutilBootstrapper\SvcutilBootstrapper.csproj]

Build FAILED.

C:\Program Files\dotnet\sdk\6.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [C:\Users\myself\AppData\Local\Temp\dotnet-svcutil-lib_Temp\2021_Nov_12_14_32_32\SvcutilBootstrapper\SvcutilBootstrapper.csproj]
CSC : error CS8630: Invalid 'nullable' value: 'Enable' for C# 7.3. Please use language version '8.0' or greater. [C:\Users\myself\AppData\Local\Temp\dotnet-svcutil-lib_Temp\2021_Nov_12_14_32_32\SvcutilBootstrapper\SvcutilBootstrapper.csproj]
    1 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.58
An error occurred while bootstrapping svcutil. This usually happens when processing references.  You might be able to work around this problem by not providing reference parameters, and manually removing any types redefined in the generated proxy code.

If you would like more help, type "dotnet-svcutil -h"

After updating to the new svcutil (version 2.0.3) the same problem occures with a much longer log. Let me know if you ned that log to .

Then i cloned the Repository and added the .NET 6 Framework as additional build Target and tested with that local build.

new csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <AssemblyVersionFile>$(IntermediateOutputPath)\$(TargetFramework)\$(MSBuildProjectName).$(TargetFramework).version.cs</AssemblyVersionFile>
  </PropertyGroup>
  
  <!--Package Properties-->
  <PropertyGroup>
    <IsPackable>true</IsPackable>
    <IsShipping>$(Ship_SvcUtilPackages)</IsShipping>
    <MajorVersion>2</MajorVersion>
    <MinorVersion>0</MinorVersion>
    <PatchVersion>4</PatchVersion>
    <PreReleaseVersionLabel>preview1</PreReleaseVersionLabel>
    <DotNetUseShippingVersions>true</DotNetUseShippingVersions>
    <GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
    <NoDefaultExcludes>true</NoDefaultExcludes>
    <EnableXlfLocalization>true</EnableXlfLocalization>
  </PropertyGroup>

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
    <RootNamespace>Microsoft.Tools.ServiceModel.Svcutil</RootNamespace>

    <PackAsTool>true</PackAsTool>
    <ToolCommandName>dotnet-svcutil</ToolCommandName>
    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
  </PropertyGroup>


  <ItemGroup>
    <ProjectReference Include="..\lib\src\dotnet-svcutil-lib.csproj" />
  </ItemGroup>
</Project>

With these changes i was able to use the dotnet-svcutil tool without problems.

Is there any plan to support .NET6?

Activity

moinessim

moinessim commented on Nov 16, 2021

@moinessim

Similar problem with the dotnet cli:

dotnet dotnet-svcutil --help

It was not possible to find any compatible framework version
The framework 'Microsoft.NETCore.App', version '5.0.0' (x64) was not found.

  • The following frameworks were found:
    6.0.0 at [..../shared/Microsoft.NETCore.App]

(...)

added
dotnet-svcutilThis issue is regarding the dotnet-svcutil tool.
toolingAn issues related to any tool shipped from this repo.
on Nov 18, 2021
bhstrifork

bhstrifork commented on Dec 7, 2021

@bhstrifork

Any news on this?

TWhidden

TWhidden commented on Jan 8, 2022

@TWhidden

After further research, the issue appears to be when targeting netstandard2.0. If you target netstandard2.1 (and net6, etc), it works.

netstandard2.0 results with this error (as shown in the original message in this thread)

CSC : error CS8630: Invalid 'nullable' value: 'Enable' for C# 7.3. Please use language version '8.0' or greater. [C:\....\dotnet-svcutil-lib_Temp\2021_Nov_12_14_32_32\SvcutilBootstrapper\SvcutilBootstrapper.csproj]
    1 Warning(s)
    1 Error(s)

Seems like the simple solution is to add to the generated csproj file <LangVersion>latest</LangVersion> but looking through the source here, I can't seem to figure out where that csproj file is actually generated at.

added a commit that references this issue on Jan 8, 2022

dotnet#4766 - Support netstandard2.0 when using net6.0 utility

core1983

core1983 commented on Jan 20, 2022

@core1983

Hello, there is some progress in remove this bug?

TWhidden

TWhidden commented on Jan 21, 2022

@TWhidden

@paulviks0x30 - While we wait for them to fix (or merge my pull request), you can pull / build from my fork. That fixed it for me, probably will fix your issue if the error message you see in this thread (lang version) was your error also. @imcarolwang had issued a run on it about 8 days ago, so they may merge the fix, but not sure how long.

zFAdler

zFAdler commented on Jan 26, 2022

@zFAdler

Thanks @TWhidden for the fork, works fine for me. Would like to see the fix in a release, is there any update/plan on when a fix will be released @imcarolwang ?

imcarolwang

imcarolwang commented on Jan 26, 2022

@imcarolwang
Contributor

Thank you @TWhidden for helping with the fix! @zFAdler, there's another PR#4772 I submitted earlier which also address this issue but in a different approach. We need to determine a proper fix for the released build.

@HongGit Could you help review the PRs and share your comments?

mxa0079

mxa0079 commented on Feb 19, 2022

@mxa0079

When will this be available in a release?

mxa0079

mxa0079 commented on Mar 4, 2022

@mxa0079

@HongGit & @imcarolwang—any comments/updates will be greatly appreciated.

21 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

dotnet-svcutilThis issue is regarding the dotnet-svcutil tool.toolingAn issues related to any tool shipped from this repo.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    svcutil dosen't work with .NET6 · Issue #4766 · dotnet/wcf