Build/Test Issues

Cannot run NCrunch due to hostfxr.dll

Started by thobey on 3,156 views

I get this error when I try to run NCrunch. I cannot understand what kind of prereq I am missing. Have anyone had this problem and has a solution?

Detected latest fxr version=[C:\Program Files (x86)\dotnet\host\fxr\6.0.8]...
Resolved fxr [C:\Program Files (x86)\dotnet\host\fxr\6.0.8\hostfxr.dll]...
Failed to load the dll from [C:\Program Files (x86)\dotnet\host\fxr\6.0.8\hostfxr.dll], HRESULT: 0x800700C1
The library hostfxr.dll was found, but loading it from C:\Program Files (x86)\dotnet\host\fxr\6.0.8\hostfxr.dll failed
- Installing .NET prerequisites might help resolve this problem.
https://go.microsoft.com/fwlink/?linkid=798306
Hi, thanks for sharing this problem.

I haven't seen this one before. I agree it looks like something needs to be (re)installed. Where do you receive this error? Does it happen when NCrunch tries to discover tests?
The problem occurs when the tests are built and Ncrunch is trying to analysing them. The same solution works fine with NCrunch on another machine, and I cannot figure out what the difference is regarding installed frameworks. Both have Dotnet 6.
It looks like this is resolving to the x86 (32-bit) path of dotnet. Is it possible you installed the x86 build of dotnet by accident, but meant to get x64 instead?
I want to build for X86. And I have stated that in the configuration in NCrunch under "Use Cpu architecture"
thobey wrote:I want to build for X86. And I have stated that in the configuration in NCrunch under "Use Cpu architecture"


Can you confirm whether your project is built to target the X86 platform?

We've found working with X86 can sometimes be more trouble than it's worth under the newer versions of .NET. Unless you have a reason for needing to deploy under x86, I do recommend using the x64 version of Dotnet where possible.
We need to deploy under x86. As I said, the same solution works on another computer. I have just changed to a new computer, and I am trying to figure out what kind of dependency/prereq I am missing. Running the tests normally with MSTest works of course.
Could you please check the following?

- Make sure all recent windows updates are installed (see here for interesting Q&A)
- Try disabling any virus scanner running on your system
- Try a uninstalling this version of the dotnet runtime and check with an earlier minor release of .net6

Also of interest: https://github.com/dotnet/sdk/issues/4240.

I suspect there is something in the platform that can do this. Note that VSTest working does not mean this problem is specific to NCrunch, as VSTest can often resolve to an entirely different version of .NET (it does not align precisely to your targeted platform version).

Post a reply

Log in to reply.