现象
发布asp.net core程序后,在其他电脑上运行时,提示
Error:An assembly specified in the application dependencies manifest (GemstarPaymentCore.deps.json) was not found:package: 'System.Security.Cryptography.ProtectedData', version: '4.5.0'path: 'runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll'
原因
是由于在GemstarPaymentCore.deps.json这个文件中,指定了System.Security.Cryptography.ProtectedData的运行目标,而发布出来的文件中默认没有包含runtimes这个文件夹引起的。
解决方案
3.1 移除运行目标设置
可以直接修改GemstarPaymentCore.deps.json文件,删除以下代码段即可
"runtimeTargets": {
"runtimes/win/lib/netstandard2.0/System.Security.Cryptography.ProtectedData.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.6.26515.6"
}
}
3.2 增加此目录和文件
也可以直接增加此目录,并且将对应版本的文件放到此目录下,让程序能找到即可正常运行。
