wcf icon indicating copy to clipboard operation
wcf copied to clipboard

Update dotnet-svcutil.xmlserializer to Support .NET 9

Open ghost opened this issue 1 year ago • 4 comments

(This is my first ever public issue, so please be gentle.)

I was trying to run a .NET 9 project that used dotnet-svcutil.xmlserializer version 8.0.0-preview1.24067.4 and getting some errors due to .NET version mismatch:

1>Microsoft (R) dotnet-svcutil.xmlserializer tool, Version 8.0.0-preview1.24067.4.
1>[Microsoft (R) Windows (R) Communication Foundation]
1>Copyright (c) Microsoft Corporation.  All rights reserved.
1>
1>Generating XML serializers...
1>EXEC : warning : There were errors loading types in an assembly loaded from 'C:\Users\Brian\source\repos\ConsoleApp1\ConsoleApp1\obj\Debug\net9.0\ConsoleApp1.dll' some types in the assembly could not be loaded and will not be available to the tool.
1>
1>  Could not load file or assembly 'System.Runtime, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
1>EXEC : warning : An error occurred in the tool.
1>
1>EXEC : warning : Could not load file or assembly 'System.Runtime, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
1>
1>C:\Users\Brian\.nuget\packages\dotnet-svcutil.xmlserializer\8.0.0-preview1.24067.4\build\dotnet-svcutil.xmlserializer.targets(63,5): warning MSB3073: The command "dotnet C:\Users\Brian\.nuget\packages\dotnet-svcutil.xmlserializer\8.0.0-preview1.24067.4\build\..\lib\net8.0\dotnet-svcutil.xmlserializer.dll obj\Debug\net9.0\ConsoleApp1.dll --quiet --out:obj\Debug\net9.0\ConsoleApp1.XmlSerializers --smreference:"C:\Users\Brian\.nuget\packages\dotnet-svcutil.xmlserializer\8.0.0-preview1.24067.4\lib\net8.0\dotnet-svcutil.xmlserializer.dll;C:\Users\Brian\.nuget\packages\microsoft.extensions.objectpool\8.0.10\lib\net8.0\Microsoft.Extensions.ObjectPool.dll;C:\Users\Brian\.nuget\packages\system.security.cryptography.pkcs\8.0.1\lib\net8.0\System.Security.Cryptography.Pkcs.dll;C:\Users\Brian\.nuget\packages\system.security.cryptography.xml\8.0.2\lib\net8.0\System.Security.Cryptography.Xml.dll;C:\Users\Brian\.nuget\packages\system.servicemodel.http\8.1.1\lib\net8.0\System.ServiceModel.Http.dll;C:\Users\Brian\.nuget\packages\system.servicemodel.primitives\8.1.1\lib\net8.0\System.ServiceModel.Duplex.dll;C:\Users\Brian\.nuget\packages\system.servicemodel.primitives\8.1.1\lib\net8.0\System.ServiceModel.Primitives.dll;C:\Users\Brian\.nuget\packages\system.servicemodel.primitives\8.1.1\lib\net8.0\System.ServiceModel.Security.dll;C:\Users\Brian\.nuget\packages\system.servicemodel.primitives\8.1.1\lib\net8.0\System.ServiceModel.dll"" exited with code 9.
1>C:\Users\Brian\.nuget\packages\dotnet-svcutil.xmlserializer\8.0.0-preview1.24067.4\build\dotnet-svcutil.xmlserializer.targets(64,5): warning : Warning : Failed to generate the serializer for ConsoleApp1.dll.

I downloaded the source for WCF and was able to change the references in the .csproj and related files to .NET 9 (I had to update the .dotnet folder as well to use the appropriate version), and I got it to successfully compile, test, and package. I tested the package in a .NET 9 console app that consumed a WCF service and was able to use the new package to successfully generate the DLL:

1>Microsoft (R) dotnet-svcutil.xmlserializer tool, Version 9.0.1-dev.25078.1.
1>[Microsoft (R) Windows (R) Communication Foundation]
1>Copyright (c) Microsoft Corporation.  All rights reserved.
1>
1>Generating XML serializers...
1>C:\Users\Brian\source\repos\ConsoleApp1\ConsoleApp1\obj\Debug\net9.0\ConsoleApp1.XmlSerializers.cs

The documentation states that any new features need to start with creating an issue. How can I submit a PR to get a new package created for .NET 9?

Image

ghost avatar Jan 29 '25 01:01 ghost

Fixed by https://github.com/dotnet/wcf/pull/5759?

xtqqczze avatar Sep 16 '25 03:09 xtqqczze

Will this library ever be updated? .net9 version is not available still

yesihaveidea avatar Nov 13 '25 14:11 yesihaveidea

Someone just needs to publish the nuget package, which is still in pre-release and the last publish was almost two years ago. I think maybe no one is responsible for publishing this package or something. Its just lost to the void.

I got tired of waiting and downloaded the WCF source, built the serializer package, and uploaded it to a private nuget repository.

We were stuck on net 8 due to this package because we deal with a large WSDL file that takes over 1 minute to generate runtime serializers if we don't pre-generate them. We can't wait 1 minute for our apps to start up on multiple servers.

What I did

Build Service Model: eng\common\cibuild.cmd -preparemachine -configuration Release -projects System.ServiceModel.sln /p:Test=false /p:Sign=false

Build Tool: eng\common\cibuild.cmd -preparemachine -configuration Release -projects dotnet-svcutil.xmlserializer.sln /p:Test=false /p:Sign=false

Upload nuget package to private nuget feed with powershell: PS .\nuget.exe push -source https://pkgs.dev.azure.com/{redacted}/_packaging/Internal_Package_Feed/nuget/v3/index.json -ApiKey AZ C:\source-code\wcf\artifacts\packages\Release\NonShipping\dotnet-svcutil.xmlserializer.8.0.0-ci.25568.1.nupkg

Using the nuget.exe Windows x86 Commandline binary: https://www.nuget.org/downloads

Hope this helps anyone else that comes across this. This tool does work with net 10.

polishninja avatar Nov 19 '25 05:11 polishninja

Someone just needs to publish the nuget package

@huanwu @mconnew Would it be possible to publish a new version of the dotnet-svcutil.xmlserializer NuGet package?

xtqqczze avatar Nov 19 '25 12:11 xtqqczze