问题
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