wcf: dotnet-svcutil.xmlserializer Could not load file or assembly System.ServiceModel.Primitives, Version=4.5.0.1

I am trying to generate VMware.vSphere.Management.Serialization using dotnet-svcutil.xmlserializer to speed up serialization https://github.com/dotnet/wcf/issues/3002, but it fails with an error about not being able to load 'System.ServiceModel.Primitives, Version=4.5.0.1 if I reference the new nuget packages. Everything is building using the microsoft/dotnet:2.1-sdk docker image.

[18:46:55][Step 1/1]   Restore completed in 2.77 sec for /build/VMware.vSphere.Management.Serialization/VMware.vSphere.Management.Serialization.csproj.
[18:46:57][Step 1/1] Microsoft (R) Service Model Metadata Tool\r\n[Microsoft (R) Windows (R) Communication Foundation, Version 1.0.0-preview1]\r\nCopyright (c) Microsoft Corporation.  All rights reserved.\r\n
[18:46:57][Step 1/1] Generating XML serializers...
[18:46:57][Step 1/1] Warning: There were errors loading types in an assembly loaded from '/build/VMware.vSphere.Management/bin/release/netstandard2.0/VMware.vSphere.Management.dll' some types in the assembly could not be loaded and will not be available to the tool.
[18:46:57][Step 1/1] 
[18:46:57][Step 1/1]   Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.5.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
[18:46:57][Step 1/1] 
[18:46:57][Step 1/1]   Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.5.0.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
[18:46:57][Step 1/1] 
[18:46:57][Step 1/1] Error: An error occurred in the tool.

VMware.vSphere.Management.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="dotnet-svcutil" Version="1.0.1" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="System.ServiceModel.Duplex" Version="4.*" />
    <PackageReference Include="System.ServiceModel.Http" Version="4.*" />
    <PackageReference Include="System.ServiceModel.NetTcp" Version="4.*" />
    <PackageReference Include="System.ServiceModel.Security" Version="4.*" />
  </ItemGroup>
</Project>

VMware.vSphere.Management.Serialization.csproj

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <DotNetCliToolReference Include="dotnet-svcutil.xmlserializer" Version="1.0.0-preview1" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\VMware.vSphere.Management\VMware.vSphere.Management.csproj" />
  </ItemGroup>
</Project>

The command failing is:

dotnet svcutil.xmlserializer $dir/VMware.vSphere.Management/bin/release/netstandard2.0/VMware.vSphere.Management.dll /out:Serialization

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

Closing this issue. Please feel free to reopen it if the problem still exists.

Reopen this issue. Although the workaround currently works, svcutil.xmlserialization tool still needs fix.