dotnet / dotnet/wcf

dotnet.svcutil-XmlSerializer fails with error Could not load System.Runtime on net7.0 project

Open
#5,328 0 comments 0 reactions 1 assignee Assigned to @mconnew View on GitHub
dotnet-svcutil.xmlserializer
Dominant language
C#
Stars
1.8k
Forks
576
Avg merge
6d 9h
Merged PRs (30d)
2

Description

**Describe the bug**
dotnet.svcutil-XmlSerializer fails to load System.Runtime for net7.0 project and no XmlSerializers dll generated for the test project

**To Reproduce**
Follow steps in [this document](https://learn.microsoft.com/en-us/dotnet/core/additional-tools/dotnet-svcutil.xmlserializer-guide), replace dotnet-svcutil.Xmlserializer package version with the one built from the latest code in wcf.git, run the tool (via "dotnet build") from a net7.0 target project.

**Expected behavior**
ConsoleClientApp.Xmlserializers.dll be generated.

**Actual result**
ConsoleClientApp.Xmlserializers.dll is not generated and got following error when running "dotnet build" for the project.

Generating XML serializers...
EXEC : warning : There were errors loading types in an assembly loaded from 'E:\Apps\dotnetSvcutilXmlSerializerTest\WcfService1\ConsoleClientApp\obj\Debug\net7.0\ConsoleClientApp.dll' some types in the assembly could not be loaded and will not be available to the tool. [E:\Apps\dotnetSvcutilXmlSerializerTest\WcfService1\ConsoleClientApp\ConsoleClientApp.csproj]

Could not load file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
Could not load file or assembly 'System.Runtime, Version=7.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
EXEC : warning : There was an error loading a contract type. Cannot generate XmlSerializer types for this contract. [E:\Apps\dotnetSvcutilXmlSerializerTest\WcfService1\ConsoleClientApp\ConsoleClientApp.csproj]
Type: ConsoleClientApp.IService1
Details:Exception has been thrown by the target of an invocation.

EXEC : warning : Cannot generate XmlSerializer types for assembly: file:///E:/Apps/dotnetSvcutilXmlSerializerTest/WcfService1/ConsoleClientApp/obj/Debug/net7.0/ConsoleClientApp.dll. No service contract types were found. [E:\Apps\dotnetSvcutilXmlSerializerTest\WcfService1\ConsoleClientApp\ConsoleClientApp.csproj]

C:\Users\userName\.nuget\packages\dotnet-svcutil.xmlserializer\[privateBuildVersion]\build\dotnet-svcutil.xmlserializer.targets(64,5): warning : Warning : Failed to generate the serializer for ConsoleClientApp.dll. [E:\Apps\dotnetSvcutilXmlSerializerTest\WcfService1\ConsoleClientApp\ConsoleClientApp.csproj]

Build succeeded.

4 Warning(s)
0 Error(s)

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.