Can not find runtime target for framework .NETCoreApp=v1 compatible with one of the target runtimes for some projects

后端 未结 1 1968
有刺的猬
有刺的猬 2020-12-16 18:36

I have a solution with many .NET Core projects. I did NuGet updates to all of the project and now when I try to build I get the following errors (for some of the projects -

相关标签:
1条回答
  • 2020-12-16 19:10

    What exactly does this runtime definition means?

    runtimes lists the runtimes that our package supports. Listing runtimes is necessary for self-contained deployments. A deployment is self-contained when it brings its own runtime.

    How do we know if our deployment is self-contained? dependencies list the packages on which our package depends. These dependencies come in three types.

    • build the package is for building only and is not part of the deployment
    • platform the package will depend on a pre-installed runtime
    • default neither of those

    If our "Microsoft.NETCore.App" dependency is of the default type, then it is self-contained, and we will need to bring our own runtimes. If it is of the platform type, then it is framework dependent.

    why was this happening only on some projects?

    It will only happen in projects that are self-contained deployments. If you look thru those projects that do not require a runtimes property, you will find that they are either class libraries or framework dependent.

    self-contained deployment

     "frameworks": {
       "netcoreapp1.0": {
         "dependencies": {
           "Microsoft.NETCore.App": {
              "version": "1.0.0"
           }
         }
       }
     },
     "runtimes": {
       "win10-x64": {},
       "osx.10.10-x64": {}
     }
    

    framework dependent deployment

     "frameworks": {
       "netcoreapp1.0": {
         "dependencies": {
           "Microsoft.NETCore.App": {
              "type": "platform",
              "version": "1.0.0"
           }
         }
       }
     }
    

    class library

     "frameworks": {
       "netstandard1.6": {}
     }
    

    how does it affect my ability to run on other os like linux or mac?

    It doesn't. Windows, Mac OS, and Linux can all either have a runtime pre-installed or have the application bring its own runtime.

    See also

    • https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json
    • https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/index
      • This link in particular is worth reading to differentiate between self-contained and framework-dependency deployments.
    • https://docs.nuget.org/ndocs/schema/project.json
    0 讨论(0)
提交回复
热议问题