简体   繁体   English

.Net Core 无法加载 hostpolicy.dll (HRESULT: 0x800700C1)

[英].Net Core can't load hostpolicy.dll (HRESULT: 0x800700C1)

I'm in the middle of upgrading my project from .Net Core 2.2 to 3.1, but I've ran into some issues.我正在将我的项目从 .Net Core 2.2 升级到 3.1,但我遇到了一些问题。 At first, by starting via the command line, I got an error message that the hostpolicy.dll couldn't be found in the output folder.首先,通过命令行启动,我收到一条错误消息,指出在输出文件夹中找不到 hostpolicy.dll。 To fix that I installed Microsoft.NETCore.DotNetHostPolicy , but now I'm getting this error message:为了解决这个问题,我安装了Microsoft.NETCore.DotNetHostPolicy ,但现在我收到此错误消息:

Failed to load the dll from [*path*\win-x86\hostpolicy.dll], HRESULT: 0x800700C1
An error occurred while loading required library hostpolicy.dll from [*path*\win-x86\]

I've seen some posts about changing the runtime identifiers so I've set mine to win7-x86;win10-x64 , but that didn't do anything for me .我看过一些关于更改运行时标识符的帖子,所以我将我的设置为win7-x86;win10-x64 ,但这对我没有任何作用。 The win7-x86 is there because it's crucial to my project that the output is 32 bit, otherwise one of the assemblies I'm using won't work at all. win7-x86之所以存在,是因为输出为 32 位对我的项目至关重要,否则我正在使用的其中一个程序集将根本无法工作。 Right now I'm letting the project compile as a DLL so I can start via the CMD and get some more detailed error messages.现在我让项目编译为 DLL,这样我就可以通过 CMD 启动并获得一些更详细的错误消息。

Here's some more info out of my .csproj:这是我的 .csproj 中的更多信息:

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RuntimeIdentifiers>win7-x86;win10-x64</RuntimeIdentifiers>
    <Platforms>x86</Platforms>
    <OutputType>library</OutputType>
    <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
  </PropertyGroup>

And out of my .pubxml:从我的 .pubxml 中:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <PublishProvider>FileSystem</PublishProvider>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>x86</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <RuntimeIdentifier>win-x86</RuntimeIdentifier>
    <publishUrl>bin\Release\netcoreapp3.1\x86\publish\</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <SelfContained>true</SelfContained>
    <_IsPortable>false</_IsPortable>
    <PublishSingleFile>False</PublishSingleFile>
    <PublishTrimmed>False</PublishTrimmed>
    <PublishReadyToRun>False</PublishReadyToRun>
  </PropertyGroup>
</Project>

My runtimeconfig looks like this atm:我的 runtimeconfig 看起来像这样的 atm:

{
  "runtimeOptions": {
"tfm": "netcoreapp3.1",
"includedFrameworks": [
  {
    "name": "Microsoft.NETCore.App",
    "version": "3.1.0"
  },
  {
    "name": "Microsoft.AspNetCore.App",
    "version": "3.1.0"
  }
],
"configProperties": {
  "System.GC.Server": true
    }
  }
}

While it may not be a particularly nice solution, I got it fixed by just creating a new project with .Net Core 3.1 and importing all the same files.虽然它可能不是一个特别好的解决方案,但我只是通过使用 .Net Core 3.1 创建一个新项目并导入所有相同的文件来解决它。 Made some slight changes to the Startup.cs and Program.cs from the template to fit my needs and now it's working again.对模板中的 Startup.cs 和 Program.cs 进行了一些细微更改以满足我的需要,现在它又可以正常工作了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 未知错误:0x800700c1,在 VS Code 中调试 .net Core 3.0 API 时 - Unknown Error: 0x800700c1, While debugging .net Core 3.0 API in VS Code 将 .NET Core 控制台应用程序部署到 Azure WebJobs 时加载 hostpolicy.dll 时出错 - Error loading hostpolicy.dll while deploying .NET Core console app to Azure WebJobs Microsoft Ink InkAnalyzer“……不是有效的Win32应用程序。 (来自HRESULT的异常:0x800700C1)” - Microsoft Ink InkAnalyzer “… is not a valid Win32 application. (Exception from HRESULT: 0x800700C1)” 执行应用程序所需的库“hostpolicy.dll” - The library 'hostpolicy.dll' required to execute the application 无法加载.dll文件(HRESULT 0x80070002) - Can't load .dll file (HRESULT 0x80070002) 加载所需库 hostpolicy.dll 时出错 - An error occurred while loading required library hostpolicy.dll Azure .net6.0 上的函数无法在本地运行 hostpolicy.dll 错误 - Azure Functions on .net6.0 fail to run locally with hostpolicy.dll error 消息:遇到致命错误。 在“C:\Program Files\dotnet”中找不到执行应用程序所需的库“hostpolicy.dll” - Message: A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found in 'C:\Program Files\dotnet' C#无法加载DLL(无法找到模块HRESULT:0x8007007E) - C# Unable to load DLL (Module could not be found HRESULT: 0x8007007E) C#DLL中的Log4Net无法加载配置 - Log4Net in C# DLL can't load configuration
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM