Protobuf-net缺少依赖项System.Private.ServiceModel [英] Protobuf-net has missing dependency System.Private.ServiceModel

查看:44
本文介绍了Protobuf-net缺少依赖项System.Private.ServiceModel的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个使用protobuf-net序列化和反序列化protobuf消息的项目.它可以在Windows上很好地构建,但是在我们的Linux构建环境中,我们似乎最终缺少依赖项.

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.

当dotnet core 2.1服务运行时,我们将收到以下错误消息:

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

在应用程序依赖清单中指定的程序集找不到(xxxx.deps.json):

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

包:"System.Private.ServiceModel",版本:"4.5.3"路径:'运行时/unix/lib/netstandard2.0/System.Private.ServiceModel.dll'未定义

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

如何最好地解决这个问题?

How best to solve this?

推荐答案

当前的解决方法是在项目构建事件中将该库简单地复制到所需位置

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>

还有条件,该条件仅适用于Windows操作系统.

There is also condition that enables only for Windows OS.

这篇关于Protobuf-net缺少依赖项System.Private.ServiceModel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆