NET应用程序在错误的位置查找运行时



我有。NET SDK安装在我的Windows笔记本电脑上,并且能够运行一个简单的C#HelloWorld程序。.Net安装在C:Program Filesdotnet上,我在PATH变量中也设置了它。

我现在正在尝试运行另一个。NET应用程序。它是用exe运行的,但我所能看到的只是屏幕上快速闪烁的cmd windo。以下错误出现在我的事件查看器中:

Description: A .NET Core application failed.
Application: Cdi.FinancialCalculator.Api.exe
Path: C:workspaceDataInsightscontentdi.Calculator.Api.exe
Message: A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in [C:workspaceDataInsightscontent].
If this is a framework-dependent application, install the runtime in the global location [C:Program Files (x86)dotnet] or use the DOTNET_ROOT(x86) environment variable to specify the runtime location or register the runtime location in [HKLMSOFTWAREdotnetSetupInstalledVersionsx86InstallLocation].
The .NET Core runtime can be found at:
- https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x86&rid=win10-x86

这就像这个应用程序正在寻找。NET运行时位于错误的位置。如何解决此问题?

更新

我添加了值为c:Program FilesdotnetDOTNET_CORE(x86)环境变量。当我现在运行我的应用程序时,我得到了这个错误:

Description: A .NET Core application failed.
Application: di.Calculator.Api.exe
Path: C:WorkspaceDataInsightscontentdi.FinancialCalculator.Api.exe
Message: Failed to load the dll from [C:Program Filesdotnethostfxr3.1.3hostfxr.dll], HRESULT: 0x800700C1
The library hostfxr.dll was found, but loading it from C:Program Filesdotnethostfxr3.1.3hostfxr.dll failed
- Installing .NET Core prerequisites might help resolve this problem.
https://go.microsoft.com/fwlink/?linkid=798306

我看到过不同的帖子,说安装KB2533623解决了Windows7的问题,但我在Windows10上,这似乎不适用。有人能帮忙解决这个问题吗?

我删除了DOTNET_CORE(x86)并安装了32位运行时。

最新更新