Closed
Description
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 commentedon Nov 16, 2021
Similar problem with the dotnet cli:
dotnet dotnet-svcutil --help
bhstrifork commentedon Dec 7, 2021
Any news on this?
TWhidden commentedon Jan 8, 2022
After further research, the issue appears to be when targeting
netstandard2.0
. If you targetnetstandard2.1
(and net6, etc), it works.netstandard2.0 results with this error (as shown in the original message in this thread)
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.dotnet#4766 - Support netstandard2.0 when using net6.0 utility
core1983 commentedon Jan 20, 2022
Hello, there is some progress in remove this bug?
TWhidden commentedon Jan 21, 2022
@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 commentedon Jan 26, 2022
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 commentedon Jan 26, 2022
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 commentedon Feb 19, 2022
When will this be available in a release?
mxa0079 commentedon Mar 4, 2022
@HongGit & @imcarolwang—any comments/updates will be greatly appreciated.
21 remaining items