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

后端 未结 10 1999
你的背包
你的背包 2020-12-02 06:29

I am trying to migrate an Asp.Net Core RC1 project to RC2 and have been following this documentation and have also followed the instructions for DNX migration to .NET CLI.

相关标签:
10条回答
  • 2020-12-02 07:01

    in project.json I changed this (added type):

    //"Microsoft.NETCore.App": "1.1.0",
    "Microsoft.NETCore.App": { "version": "1.1.0", "type": "platform" },
    

    Now I can build again :-)

    update: now I can build again but not "run" the website.

    You need to make sure you have the runtime and sdk also:

    *) Visual Studio tools include .NET Core 1.0.1. To add .NET Core 1.1 support you need to also install the .NET Core 1.1 runtime.

    https://www.microsoft.com/net/download/core#/current

    0 讨论(0)
  • 2020-12-02 07:01

    If you read these two links:

    First, https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/using-with-xplat-cli

    and

    second, https://docs.microsoft.com/en-us/dotnet/articles/core/rid-catalog

    You will see that you can build a completely portable version using the following snippet in the dependencies root element in project.json. There is no need to specify runtimes as this is a CORE level runtime which should be platform agnostic, or known as "Framework dependent"

    "Microsoft.NETCore.App": {
        "type": "platform",
        "version": "1.0.1"
    }
    

    or you can build for multiple targeted platforms ("self contained applications") by removing the type: platform element like this:

    Add this to the dependencies root element in project.json

    "Microsoft.NETCore.App": {
        "version": "1.0.1"
    }
    

    and add this as a new root level element

    "runtimes": {
        "win10-x64": {},  /* one or more RIDs */
        "osx.10.10-x64": {}
      },
    

    Multiple targeted requires that you supply platform names known as ".NET Core Runtime IDentifiers (RID)" A list of these can be found at the second link above. It includes many flavors of Windows, Linux and OS X.

    For a good overview of the various deployment optins, you can read this page as well:

    https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/index

    From the above link:

    You can create two types of deployments for .NET Core applications:

    Framework-dependent deployment

    As the name implies, framework-dependent deployment (FDD) relies on a shared system-wide version of .NET Core to be present on the target system. Because .NET Core is already present, your app is also portable between installations of .NET Core. Your app contains only its own code and any third-party dependencies that are outside of the .NET Core libraries. FDDs contain .dll files that can be launched by using the dotnet utility from the command line. For example, dotnet app.dll runs an application named app.

    Self-contained deployment

    Unlike FDD, a self-contained deployment (SCD) does not rely on any shared components to be present on the target system. All components, including both .NET Core libraries and the .NET Core runtime, are included with the application and are isolated from other .NET Core applications. SCDs include an executable (such as app.exe on Windows platforms for an application named app), which is a renamed version of the platform-specific .NET Core host, and a .dll file (such as app.dll), which is the actual application.

    0 讨论(0)
  • 2020-12-02 07:04

    I found one useful link from comment by svick under following page: https://github.com/dotnet/cli/issues/2442

    0 讨论(0)
  • 2020-12-02 07:10

    I received this error because I used the incredibly broken NuGet Package Manager in Visual Studio 2015 to update my project.json dependencies. It turned this:

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

    into this:

    "dependencies": {
      "Microsoft.NETCore.App": "1.1.0"
    },
    "frameworks": {
      "netcoreapp1.0": {}
    }
    

    Bye bye, platform definition!

    0 讨论(0)
提交回复
热议问题