You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Testhost process exited with error: A fatal error was encountered. The library
'hostpolicy.dll' required to execute the application was not found in '<project>'.
Failed to run as a self-contained app. If this should be a
framework-dependent app, add the <project>\testhost.runtimeconfig.json
file specifying the appropriate framework.
The text was updated successfully, but these errors were encountered:
Using RuntimeIdentifier and OutputType Exe on netcoreapp3.1 (and newer) will make the build basically publish the project. This will add the runtime to the result directory and change the runtimeconfig.json to point to the local copy of the runtime.
// in your .csproj
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>osx.10.11-x64;osx.10.12-x64;win7-x64;win10-x64</RuntimeIdentifiers>
When executing tests, testhost.exe is loaded from a different location (nuget folder), but using the same runtimeconfig.json as the test project, and will fail to find the hostpolicy, because it only looks next to the executable, where there is no hostpolicy.dll.
The solution here is to copy the testhost.exe next to the project and invoke it from there, which was fixed early in 16.6.0. Please update your Microsoft.NET.Test.Sdk nuget package to 16.6.1
I am encountering this error:
The text was updated successfully, but these errors were encountered: