'Consume Large WSDL in .NET 5

In .NET 5, I have a rather large WSDL that I've run through the .NET service reference importer. It generates approximately 660,000 of lines of C# code. I also added a reference to the dotnet-svcutil.xmlserializer 1.2.0 NuGet package so that performance is improved. I also have the following NuGet packages installed (all version 4.9.0):

  • System.ServiceModel.Duplex
  • System.ServiceModel.Http
  • System.ServiceModel.NetTcp
  • System.ServiceModel.Security

However, when I attempt to build my solution, I get the following:

Build started...
1>------ Build started: Project: WebApplication1, Configuration: Debug Any CPU ------
1>WebApplication1 -> C:\Projects\Code\WebApplication1\WebApplication1\bin\Debug\net5.0\WebApplication1.dll
1>WebApplication1 -> C:\Projects\Code\WebApplication1\WebApplication1\bin\Debug\net5.0\WebApplication1.Views.dll
1>C:\Users\bchambers\.nuget\packages\dotnet-svcutil.xmlserializer\1.2.0\build\dotnet-svcutil.xmlserializer.targets(16,5): error NETSDK1005: Assets file 'C:\Projects\Code\WebApplication1\WebApplication1\obj\project.assets.json' doesn't have a target for 'netcoreapp2.1'. Ensure that restore has run and that you have included 'netcoreapp2.1' in the TargetFrameworks for your project.
1>Done building project "WebApplication1.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

It seems like the dotnet-svcutil.xmlserializer tool only works with .NET Core 2.1. I followed the steps in this document:

https://docs.microsoft.com/en-us/dotnet/core/tools/sdk-errors/netsdk1005

I'm using MSBuild 17, the project is restored, etc. I'm using Visual Studio 2022 Enterprise. I've tried deleting the obj folder, building a second time. The only option that seems to make sense is this:

Make sure that the missing target value is included in the TargetFrameworks property of your project.

Which indicates, again, that this is only compatible with .NET Core 2.1.

It seems like I may have a couple of options:

  1. Create a class library targeting .NET Core 2.1 and then reference it in a .NET 5 project (unsure if this will work).
  2. Target .NET Standard and hopefully I won't need all of the other features (my solution is Windows-only, so this may work).

Is there something I'm missing? Has anyone gotten this tool to work with versions of .NET Core >2.1? How am I supposed to consume a large WSDL without this tool and still have good performance? Without the dotnet-svcutil.xmlserializer tool, the first service call after building takes >30 seconds.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source