从Python运行.NET Core时找不到Hostpolicy.dll错误

时间:2018-08-28 08:19:25

标签: python .net-core pipe

我正在尝试从python运行Net Core Application,并且收到此错误消息:

 error:"A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'D:\\BenchmarkingApp\\BenchmarkingApp\\bin\\Debug\\netcoreapp2.1\\'.\r\nFailed to run as a self-contained app. If this should be a framework-dependent app, add the D:\\BenchmarkingApp\\BenchmarkingApp\\bin\\Debug\\netcoreapp2.1\\BenchmarkingApp.runtimeconfig.json file specifying the appropriate framework.\r\n"

为什么会出现此错误?

Python代码

import subprocess
csServerPath = "D:\\BenchmarkBuild\server\Server.dll"

def main():
    command = "dotnet D:\\BenchmarkingApp\\BenchmarkingApp\\bin\Debug\\netcoreapp2.1\\BenchmarkingApp.dll 1 2 3"
    process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
    (output, err) = process.communicate()
    print("output:"+str(output))
    print("error:"+str(err))

main()

PS 如果您将我指向此链接:The library hostpolicy.dll was not found作为重复链接,我将appname.runtimeconfig.jsonappname.dll

放在同一路径中

0 个答案:

没有答案