wcf icon indicating copy to clipboard operation
wcf copied to clipboard

svcutil dosen't work with .NET6

Open zTGross opened this issue 3 years ago • 23 comments

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?

zTGross avatar Nov 12 '21 14:11 zTGross

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]

(...)

moinessim avatar Nov 16 '21 14:11 moinessim

Any news on this?

bhstrifork avatar Dec 07 '21 07:12 bhstrifork

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.

TWhidden avatar Jan 08 '22 01:01 TWhidden

Hello, there is some progress in remove this bug?

core1983 avatar Jan 20 '22 07:01 core1983

@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.

TWhidden avatar Jan 21 '22 03:01 TWhidden

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 ?

zFAdler avatar Jan 26 '22 09:01 zFAdler

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?

imcarolwang avatar Jan 26 '22 09:01 imcarolwang

When will this be available in a release?

mxa0079 avatar Feb 19 '22 08:02 mxa0079

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

mxa0079 avatar Mar 04 '22 09:03 mxa0079

@HongGit, @imcarolwang Can you give any update on when the new version will be available? Is there anything currently holding back the release?

zFAdler avatar May 04 '22 20:05 zFAdler

+1

felixpelletier avatar May 27 '22 18:05 felixpelletier

+1

drlivsi avatar Aug 11 '22 06:08 drlivsi

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]

(...)

Just ran into this issue as well. Would be nice to have a net6 compatible version.

LarsCelie avatar Sep 01 '22 13:09 LarsCelie

+1

ragoso avatar Sep 03 '22 20:09 ragoso

+1

finflaex avatar Sep 12 '22 10:09 finflaex

Same issue here

ocell avatar Sep 20 '22 09:09 ocell

Any news on this 👀 ?

antonina-lobach avatar Sep 26 '22 09:09 antonina-lobach

+1

AndrzejKrol avatar Sep 26 '22 09:09 AndrzejKrol

+1

adam-sajdak-ap avatar Sep 26 '22 09:09 adam-sajdak-ap

apparently an unofficial refusal of support

finflaex avatar Sep 26 '22 10:09 finflaex

@HongGit or @imcarolwang Can you please release the update? The PR has been merged for a while now, we're all just waiting for the release 😕

As you can see more and more developers need this update... And there will probably be many more migrating to .NET 6 and wondering why it doesn't work anymore...

zFAdler avatar Sep 26 '22 10:09 zFAdler

Sorry for the delay, we're working on it, it's coming soon!

imcarolwang avatar Sep 26 '22 11:09 imcarolwang

Same problem here... Screenshot from 2022-10-09 16-57-48

federico-r-figueredo avatar Oct 09 '22 20:10 federico-r-figueredo

Sorry for the delay, we're working on it, it's coming soon!

Any update about the release date please?

NurhakKaya avatar Oct 20 '22 18:10 NurhakKaya

The version with .NET6 support is finally released, you can try out by reinstalling the tool with commandlines below.

Uninstall existing version: dotnet tool uninstall --global dotnet-svcutil

Install the new version: dotnet tool install --global dotnet-svcutil --version 2.1.0

imcarolwang avatar Oct 28 '22 07:10 imcarolwang

Can confirm this is working perfectly. Thanks!

gabrielmaldi avatar Oct 28 '22 23:10 gabrielmaldi

related I believe #4961

kbegiedza avatar Dec 05 '22 18:12 kbegiedza

Close as dotnet-svcutil 2.1.0 is already released.

HongGit avatar Dec 07 '22 03:12 HongGit

Hello,

I have the same issue, by trying to add a WCF Service Reference from visual studio, in a project with netstandar2.0.

image

If I change the TargetFramework to .net6 it works.

I know that you close the issue, but maybe this can help you to find the issue.

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

ffalsino avatar Dec 09 '22 22:12 ffalsino