-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
With NET 5 RC1 x86 SDK installed on x64 OS, run Unit test failed with error: Testhost process exited with error: A fatal error occurred, the required library hostfxr.dll could not be found... #13157
Comments
@pavelhorak could you look into it? |
@vdanche I cannot repro this issue on with NET 5 RC1 x86 - (5.0.100-rc.1.20454.5)
Can you try again? If it doesn't work share hahah.csproj project file and listing of |
@pavelhorak, I can repro this issue on with NET 5 RC1 x86 - (5.0.100-rc.1.20454.5) Runtime Environment: Host (useful for support): .NET SDKs installed: .NET runtimes installed: To install additional .NET runtimes or SDKs: C:\Users\v-danche>cd C:\Users\v-danche\test C:\Users\v-danche\test>"%ProgramFiles(x86)%/dotnet/dotnet" new mstest -o mymstest Processing post-creation actions... C:\Users\v-danche\test>cd mymstest C:\Users\v-danche\test\mymstest>"%ProgramFiles(x86)%/dotnet/dotnet" build Determining projects to restore... Build succeeded. Time Elapsed 00:00:01.29 C:\Users\v-danche\test\mymstest>"%ProgramFiles(x86)%/dotnet/dotnet" test Starting test execution, please wait... Test Run Aborted. C:\Users\v-danche\test\mymstest> |
My project has been attached. Thanks |
The reason why I could not repro locally is that I have also x64 version of SDK installed on machine. Now, since you are on x64 OS, regardless of having only x86 SDK, you need to implicitly build x86 version to make it work.
Thank @nohwnd for helping me. |
There are actually 3 ways you can fix this. I would suggest 1.:
If this is a test scenario, I think it should be re-visited. At one point in time we broke this logic and got multiple reports of dotnet test incorrectly looking for x86 SDK which was not present on the system (64-bit OS with only 64-bit SDK). I don't think we ever got the report of this inverse case (64-bit OS with only 32-bit SDK, apart from you reporting it. |
Got it and will update out testcase. Thanks! |
I don't think this is a valid option. At least in my CI scenarios, I explicitly download and install the 32-bit SDK because I am testing my binaries when run under 32-bit mode.
This doesn't work at the solution level and you will get an error such as:
This is the same issue as 2 and shouldn't be required, IMO. You should be able to just do something akin to
Why is there any guessing here at all? If |
Machine OS: win10-x64
Repro Steps
Install NET 5 RC1 x86 SDK from https://github.com/dotnet/installer on x64 OS
dotnet new xunint/mstest/nunit in CLI
dotnet build and then dotnet test
Expected result:
Unit test run successfully
Actual result:
run failed with below error:
Testhost process exited with error: 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:\Users\v-danche\today\hahah\bin\Debug\net5.0].
If this is a framework-dependent application, install the runtime in the default location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location.
. Please check the diagnostic logs for more information.
Test Run Aborted.
C:\Program Files (x86)\dotnet\sdk\5.0.100-rc.1.20427.1\Microsoft.TestPlatform.targets(32,5): error MSB4181: The "Microsoft.TestPlatform.Build.Tasks.VSTestTask" task returned false but did not log an error. [C:\Users\v-danche\today\hahah\hahah.csproj]
Note:
It doesn't repro on x64 SDK.
It only repro on NET 5 RC1 x86.
Dotnet --info:
.NET SDK (reflecting any global.json):
Version: 5.0.100-rc.1.20427.1
Commit: dd2e854
Runtime Environment:
OS Name: Windows
OS Version: 10.0.18362
OS Platform: Windows
RID: win10-x86
Base Path: C:\Program Files (x86)\dotnet\sdk\5.0.100-rc.1.20427.1\
Host (useful for support):
Version: 5.0.0-rc.1.20426.10
Commit: bfc00e4e13
.NET SDKs installed:
5.0.100-rc.1.20427.1 [C:\Program Files (x86)\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.0-rc.1.20426.3 [C:\Program Files (x86)\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.0-rc.1.20426.10 [C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.0-rc.1.20426.4 [C:\Program Files (x86)\dotnet\shared\Microsoft.WindowsDesktop.App]
To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download
The text was updated successfully, but these errors were encountered: