sdk: "Could not load host policy library" after updates

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

About this issue

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

Most upvoted comments

@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

@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.

@tugberkugurlu you can use the nuget locals commands (I’m using nuget.exe 3.3):

  • list all package cache locations: nuget.exe locals all -list
  • clear all package caches: nuget.exe locals all -clear

@tugberkugurlu That’s cool. You’re using the CI release feed, right? I can’t repro that here. You might want to nuke your package cache.