question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Could not load host policy library" after updates

See original GitHub issue

When I try to run an application that includes the Microsoft.NETCore.App library, such as the one created by dotnet new, I get the error message…

“Could not load host policy library”

Steps to reproduce

  • Install the latest dot net cli build (as of 3/24/2016 - 4:11 PM CST, it is version 1.0.0-beta-001986)
  • create a new folder anywhere
  • open a command line in the new folder
  • in the command line, run dotnet new
  • in the project.json, change Microsoft.NET.Core.App to use version 1.0.0-rc-*
  • in the command line, run dotnet restore
  • in the command line, run dotnet run

Expected behavior

The app should run as expected; Hello World! ought to be printed to the console.

Actual behavior

The following is printed to the console.

NuGet Config files used:
    C:\Users\Ciel\Documents\Visual Studio 2015\Projects\n\NuGet.Config
    C:\Users\Ciel\AppData\Roaming\NuGet\NuGet.Config

Feeds used:
    https://dotnet.myget.org/F/dotnet-core/api/v3/index.json
    https://api.nuget.org/v3/index.json
PS C:\Users\Ciel\Documents\Visual Studio 2015\Projects\n> dotnet run
Compiling n for .NETStandard,Version=v1.5
C:\Users\Ciel\Documents\Visual Studio 2015\Projects\n\project.json(7,30): warning NU1007: Dependency specified was Microsoft.NETCore.App >= 1.0.0-rc-* but ended up with Microsoft.NETCore.App 1.0.0-rc2-23910.

Compilation succeeded.
    1 Warning(s)
    0 Error(s)

Time elapsed 00:00:02.2376827


Could not load host policy library [C:\Users\Ciel\Documents\Visual Studio 2015\Projects\n\bin\Debug\netstandard1.5]

Environment data

dotnet --version output:

.NET Command Line Tools (1.0.0-beta-001986)

Product Information:
 Version:     1.0.0-beta-001986
 Commit Sha:  f0fd9ae901

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 Runtime Id:  win10-x64

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
miguelliracommented, Mar 26, 2016

@ciel BTW… I attemped to run the HelloMvc sample app from https://github.com/aspnet/cli-samples on my Windows 10 setup with the latest CLI and ran into the same issue I logged here: https://github.com/aspnet/Mvc/issues/4349 so although neither works at lease both my Mac and Windows machine are on par 😕

FYI, in order to get the HelloMvc app to run against the latest CLI I updated the project.json to this:

"frameworks": {
        "netcoreapp1.0": {
            "dependencies": {
                "NETStandard.Library": "1.5.0-*"
            },
            "imports": [
                "dnxcore50",
                "portable-net45+win8"
            ]
        }
    }

NOTE: I used netcoreapp1.0 instead of netstandardapp1.5 based on this thread: https://github.com/NuGet/Home/issues/2299

1reaction
tugberkugurlucommented, Apr 22, 2016

@nil4 thanks. It confusing to have nuget.exe and dotnet.exe at the same time. dotnet CLI should be able to do any work nuget.exe can do.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The library hostpolicy.dll was not found
NET Core project (console app) that I'm trying to compile and run. dotnet build succeeds, but I get the following error when I...
Read more >
Improving .NET host error messages and supportability
NET app is launched by a native host, which needs to find and load a compatible .NET runtime to execute app code. Sometimes...
Read more >
Error: Unable to load shared library 'hostfxr' or one of its ...
Hi, I am running on macOS Big Sur version 11.7.1 on Intel Processor. After I installed Radzen Blazor Studio, I tried to create...
Read more >
How to Fix the 'Preview Could Not Be Loaded' Error
If you receive the error message “the preview could not be loaded”, try the following: Enable Safe Mode. Follow the procedures outlined in...
Read more >
Troubleshoot WorkSpaces issues - AWS Documentation
I am trying to do something that requires Windows installation media but WorkSpaces does not provide it. I want to launch WorkSpaces with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found