Protobuf-net has missing dependency System.Private.ServiceModel

淺唱寂寞╮ 提交于 2021-02-08 10:00:09

问题


We have a project that uses protobuf-net for serialising and deserialising our protobuf messages. It builds fine on windows, but on our Linux build environment we seem to end up missing a dependency.

When the dotnet core 2.1 service runs up we get an error of:

An assembly specified in the application dependencies manifest (xxxx.deps.json) was not found:

package: 'System.Private.ServiceModel', version: '4.5.3' path: 'runtimes/unix/lib/netstandard2.0/System.Private.ServiceModel.dll' undefined

How best to solve this?


回答1:


Current workaround is to simply copy this library to desired location on project build event

  <Target Name="BuildProces" BeforeTargets="Build">
    <Copy Condition=" '$(OS)' == 'Windows_NT' "  
          SourceFiles="$(USERPROFILE)\.nuget\packages\system.private.servicemodel\4.5.3\runtimes\win\lib\netstandard2.0\System.Private.ServiceModel.dll"
          DestinationFolder="$(OutputPath)\runtimes\unix\lib\netstandard2.0\" />
  </Target>

There is also condition that enables only for Windows OS.



来源:https://stackoverflow.com/questions/53853817/protobuf-net-has-missing-dependency-system-private-servicemodel

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!