【问题标题】:Protobuf-net has missing dependency System.Private.ServiceModelProtobuf-net 缺少依赖 System.Private.ServiceModel
【发布时间】:2018-12-19 14:56:35
【问题描述】:
我们有一个项目使用 protobuf-net 序列化和反序列化我们的 protobuf 消息。它在 Windows 上构建良好,但在我们的 Linux 构建环境中,我们似乎最终缺少了一个依赖项。
当 dotnet core 2.1 服务启动时,我们会收到以下错误:
应用程序依赖清单中指定的程序集
(xxxx.deps.json) 未找到:
包:'System.Private.ServiceModel',版本:'4.5.3' 路径:
'运行时/unix/lib/netstandard2.0/System.Private.ServiceModel.dll'
未定义
如何最好地解决这个问题?
【问题讨论】:
标签:
.net-core
protobuf-net
【解决方案1】:
当前的解决方法是简单地将这个库复制到项目构建事件的所需位置
<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 操作系统。