sdk: Could not resolve coreclr path

My project.json file looks like below:

{
    "version": "0.0.0",
    "compilationOptions": {
        "emitEntryPoint": true
    },
    "dependencies": {
        "BonVoyage": "*"
    },
    "frameworks": {
        "netcoreapp1.0": {
            "imports": [
                "portable-net45+wp80+win8+wpa81+dnxcore50"
            ]
        }
    }
}

when I run dotnet run after running dotnet restore --no-cache, I am getting the below error:

$ dotnet run
Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes: 'ubuntu.14.04-x64'. Possible causes:
The project has not been restored or restore failed - run dotnet restore
The project does not list one of 'ubuntu.14.04-x64' in the 'runtimes' section.

I added the runtime and did another restore:

{
    "version": "0.0.0",
    "compilationOptions": {
        "emitEntryPoint": true
    },
    "dependencies": {
        "BonVoyage": "*"
    },
    "frameworks": {
        "netcoreapp1.0": {
            "imports": [
                "portable-net45+wp80+win8+wpa81+dnxcore50"
            ]
        }
    },
    "runtimes": {
        "ubuntu.14.04-x64": {}
    }
}

now I am getting this:

$ dotnet run
Project BonVoyage (.NETStandard,Version=v1.1) was previously compiled. Skipping compilation.
Compiling Foo.Sync for .NETCoreApp,Version=v1.0
/home/tugberk/apps/Foo/src/Foo.Sync/project.json(7,25): warning NU1007: Dependency specified was BonVoyage >= * but ended up with BonVoyage 0.0.0-0.

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

Time elapsed 00:00:04.7361717


Could not resolve coreclr path

Not sure about a few things:

  • why do I need to specify the runtime inside the project.json file? I expected to do this through the global.json file.
  • why am I getting this error?

Environment data

dotnet --info output:

$ dotnet --info
.NET Command Line Tools (1.0.0-rc2-002416)

Product Information:
 Version:     1.0.0-rc2-002416
 Commit Sha:  37f00f24e9

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  14.04
 OS Platform: Linux
 RID:         ubuntu.14.04-x64

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

The error messages are pretty horrible overall but @schellap has been tackling them one by one. It would be great if the error told you, what the available versions were as well.

https://github.com/dotnet/cli/pull/2648/files

Just closing the loop on this one… the error message was improved since https://github.com/dotnet/cli/pull/2709.

The escrow builds displays this message.

The targeted framework { 'Microsoft.NETCore.App': '1.0.0-rc9-3002543' } was not found.
  - Check application dependencies and target a framework version installed at:
      H:\Chrome Downloads\shared\Microsoft.NETCore.App
  - The following versions are installed:
      1.0.0-rc2-3002700
  - Alternatively, install the framework version '1.0.0-rc9-3002543'.

@tugberkugurlu Upgrade it, your CLI is too old for the shared runtime you’re trying to use.

Could not load host policy library from [/usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0-rc2-3002426] This may be because the targeted framework [“Microsoft.NETCore.App”: “1.0.0-rc2-3002426”] was not found.

I believe the versioning scheme looks like this:

CLI version = {version} Shared Framework version = 300{version}

Your shared framework version can’t be higher than your CLI version (because the CLI comes with a version of the shared framework, but yours is too low.

If your goal was to produce a shared framework application, you need the packages in Microsoft.NETCore.App with a "type": "platform" to indicate that that those packages (including the runtime) will be supplied on the platform where the app will be deployed …

"Microsoft.NETCore.App": {
    "type": "platform",
    "version": "1.0.0-*"
}

which includes things like the NETStandard library and the host executable. The platform where you deploy the app should have the shared framework installed on it. The app will be executed on that platform with the command dotnet .\myapp.dll. [Note that I’m using -* here and not -rc2-* as some samples show. I can get away with this right now and only receive rc2 packages because my feeds are only supplying rc2 packages. I’m using the CI release feed, such as you see in the cli-samples repo, where there are only rc2 packages available.]

Alternatively if your plan was to produce a standalone (self-contained) application (as it appears that you’re doing), then dotnet cli will need to know the runtime to use in order to produce outputs (i.e., dotnet publish --configuration Release --runtime ubuntu.14.04-x64). That app can be started directly from the executable produced for the Ubuntu platform. You will also need the "Microsoft.NETCore.DotNetHostPolicy": "1.0.1-*" dependency in order to get the right host executable in the published output. For my standalone apps, I’ve found it useful to reference the "NETStandard.Library": "1.5.0-*" meta-package with the DotNetHostPolicy package, which provides a nice surface area to program Core CLR standalone apps against.

RE: " * " (pure star) package references, that is not supported AFAIK. They’ll jump in if I’m incorrect on that. Did you try 1.0.0-* or 1.0.0?