Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not resolve coreclr path #5844

Closed
tugberkugurlu opened this issue Apr 22, 2016 · 18 comments
Closed

Could not resolve coreclr path #5844

tugberkugurlu opened this issue Apr 22, 2016 · 18 comments

Comments

@tugberkugurlu
Copy link

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
@guardrex
Copy link
Contributor

guardrex commented Apr 22, 2016

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?

@tugberkugurlu
Copy link
Author

@guardrex my aim is to produce a platform independent executable. I wanted to have Microsoft.NETCore.App platform reference to but it complaint with the below error:

/home/tugberk/apps/Foo/src/Foo.Sync/project.json(8,35): error DOTNET1013: The following dependencies are marked with type 'platform', however only one dependency can have this type: Microsoft.NETCore.App, NETStandard.Library

I am assuming this is because my library platform reference to NETStandard.Library:

{
  "version": "0.0.0-0",
  "authors": [ "Tugberk.Ugurlu" ],

  "dependencies": {
    "Newtonsoft.Json": "8.0.1"
  },

  "frameworks": {
    "netstandard1.1": {
      "imports": [
        "portable-net45+wp80+win8+wpa81+dnxcore50"
      ],
      "dependencies": {
        "NETStandard.Library": {
          "type": "platform",
          "version": "1.5.0-rc2-24018"
        }
      }
    },

    "net451": {
      "frameworkAssemblies": {
        "System.Net.Http": ""
      }
    }
  }
}

Any suggestions in this case? What should be using in my library project as a platform reference or none?

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?

Well, I don't want to specify a version for a project reference package. "" was working before for this but clearly it does not anymore. What is the preferred way to do this without specifying a version at all?

@tugberkugurlu
Copy link
Author

I am about to run out of hairs to pull 😄 this is really way too complicated to get going.

I handpicked the references and my library's project.json file looks like below:

{
  "version": "0.0.0-0",

  "dependencies": {
    "Newtonsoft.Json": "8.0.1"
  },

  "frameworks": {
    "netstandard1.1": {
      "imports": [
        "portable-net45+wp80+win8+wpa81+dnxcore50"
      ],

      "dependencies": {
        "System.Threading": "4.0.11-*",
        "System.Net.Http": "4.0.1-*",
        "System.Linq": "4.1.0-*"
      }
    },

    "net451": {
      "frameworkAssemblies": {
        "System.Net.Http": ""
      }
    }
  }
}

However, I am now getting this after running dotnet restore --no-cache and dotnet run:

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.

dotnet restore --no-cache output:

$ dotnet restore --no-cache
log  : Restoring packages for /home/tugberk/apps/Foo/src/Foo.Sync/project.json...
info :   GET https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/system.threading/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/system.threading/index.json
info :   GET https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/system.net.http/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/system.net.http/index.json
info :   GET https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/system.linq/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/system.linq/index.json
info :   GET https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/microsoft.netcore.app/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json
info :   OK https://api.nuget.org/v3-flatcontainer/system.threading/index.json 245ms
info :   OK https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/system.threading/index.json 334ms
info :   OK https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/system.net.http/index.json 237ms
info :   OK https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/system.linq/index.json 237ms
info :   OK https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/microsoft.netcore.app/index.json 275ms
info :   OK https://api.nuget.org/v3-flatcontainer/system.linq/index.json 459ms
info :   OK https://api.nuget.org/v3-flatcontainer/system.net.http/index.json 460ms
info :   NotFound https://api.nuget.org/v3-flatcontainer/microsoft.netcore.app/index.json 463ms
info :   GET https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/microsoft.netcore.dotnethostresolver/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostresolver/index.json
info :   OK https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/microsoft.netcore.dotnethostresolver/index.json 131ms
info :   NotFound https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethostresolver/index.json 400ms
info :   GET https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/microsoft.netcore.dotnethost/index.json
info :   GET https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethost/index.json
info :   OK https://myget-2e16.kxcdn.com/artifacts/aspnetcirelease/nuget/v3/flatcontainer/microsoft.netcore.dotnethost/index.json 74ms
info :   NotFound https://api.nuget.org/v3-flatcontainer/microsoft.netcore.dotnethost/index.json 393ms
info : Committing restore...
log  : Writing lock file to disk. Path: /home/tugberk/apps/Foo/src/Foo.Sync/project.lock.json
log  : /home/tugberk/apps/Foo/src/Foo.Sync/project.json
log  : Restore completed in 2453ms.

NuGet Config files used:
    /home/tugberk/apps/Foo/NuGet.Config
    /home/tugberk/.nuget/NuGet/NuGet.Config

@guardrex
Copy link
Contributor

When you say "library project," do you mean that you plan to dotnet pack this into a NuGet package that you can consume in other projects?

If that's the case, then you can just use "NETStandard.Library": "1.5.0-*" or Microsoft.NETCore.App": "1.0.0-*" (if using the cli-samples feeds that have CI release as the main feed) or Microsoft.NETCore.App": "1.0.0-rc2-*" (if using a different feed that has rc3 packages on it).

Of course, the exception there is correct: You can only use "type": "platform" with the Microsoft.NETCore.App package, and "type": "platform" wouldn't be relevant if you are going to dotnet pack this project into a NuGet package for other apps to use. The "type": "platform" would be relevant if this were going to be a shared framework (portable) application ... not library.

I'm on JabbR right now if you want to talk about it: https://jabbr.net/#/rooms/AspNetCore

@tugberkugurlu
Copy link
Author

When you say "library project," do you mean that you plan to dotnet pack this into a NuGet package that you can consume in other projects?

Library project means it doesn't have an entry point emitted into the produced assembly. Just like this: https://github.com/aspnet/HttpAbstractions/tree/391db10384b72be955b9987a19ec0cf4b77d22f8/src/Microsoft.AspNetCore.Http.Abstractions

@davidfowl
Copy link
Member

@tugberkugurlu Are you trying to run your library? I'm lost as to what you're trying to do.

@guardrex
Copy link
Contributor

Yeah ... I'm a little confused what you're trying to build, too.

@tugberkugurlu
Copy link
Author

tugberkugurlu commented Apr 24, 2016

@davidfowl not library, I also have another project which consumes my library project and has "emitEntryPoint": true compilation option and a static Main method (good old console app). Its project.json file looks like below:

{
    "version": "0.0.0",
    "compilationOptions": {
        "emitEntryPoint": true
    },
    "dependencies": {
        "BonVoyage": "*",
        "Microsoft.NETCore.App": {
            "type": "platform",
            "version": "1.0.0-rc2-*"
        }
    },
    "frameworks": {
        "netcoreapp1.1": {
            "imports": [
                "portable-net45+wp80+win8+wpa81+dnxcore50"
            ]
        }
    }
}

and the rest is as described in https://github.com/dotnet/cli/issues/2640#issuecomment-214036392. This is the one that I try to run dotnet run on and get the error described here.

@davidfowl
Copy link
Member

@tugberkugurlu What's your CLI version?

@guardrex
Copy link
Contributor

netcoreapp1.1

should be netcoreapp1.0

@tugberkugurlu
Copy link
Author

@davidfowl

$ 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

@tugberkugurlu
Copy link
Author

should be netcoreapp1.0

Oh yeah but that didn't help, too (rerestored everything and dotnet run):

Project BonVoyage (.NETStandard,Version=v1.1) was previously compiled. Skipping compilation.
Project Foo.Sync (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.
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.

@davidfowl
Copy link
Member

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

@tugberkugurlu
Copy link
Author

@davidfowl ah, OK. upgrading now, thanks!

It doesn't mention any incompatibility on the error message. Can this be picked up at runtime and if so, can error message be made a bit more clear?

@davidfowl
Copy link
Member

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

@tugberkugurlu
Copy link
Author

tugberkugurlu commented Apr 24, 2016

@davidfowl instead of upgrading, I locked the version of the platform reference:

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

it worked! thx!

@ghost
Copy link

ghost commented Apr 27, 2016

https://github.com/dotnet/cli/blob/rel/1.0.0/TestAssets/TestProjects/TestSimpleIncrementalApp/project.json runs with the following settings on Ubuntu 14.04:

"frameworks": {
    "netcoreapp1.0": {
        "imports": [
            "portable-net45+wp80+win8+wpa81+dnxcore50"
        ]
    }
},
"runtimes": {
    "ubuntu.14.04-x64": {}
}

@schellap
Copy link

Just closing the loop on this one... the error message was improved since dotnet/cli#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'.

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants