dotnet / dotnet/wcf

Update dotnet-svcutil.xmlserializer to Support .NET 9

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

Description

_(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](https://github.com/user-attachments/assets/5fab194d-8a2e-44c2-92fc-9e57269a871f)

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.