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

后端 未结 10 2121
你的背包
你的背包 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 06:52

    I found you need the following in project.json. Here is what was required to fix my error:

    Dependencies

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

    Frameworks

    "frameworks": {
        "netcoreapp1.0": {
          "imports": [
            "dotnet5.6",
            "portable-net45+win8"
          ]
        }
      },
    

    Runtime

      "runtimeOptions": {
        "configProperties": {
          "System.GC.Server": true
        }
      },
    

    You might want to add runtimes if you plan on publishing to IIS. Please see something as follows:

     "runtimes": {
        "win10-x64": {}
      },
    

    Here is a general tip that has worked well for me. When my stuff breaks, I sometimes create a default ASP.NET Core application either the website or empty web api to look at the dependencies in project.json and elsewhere. You can often catch a lot of things that way. The answers above are spot on, but I thought I would write this here in case someone wanted to separate the logic out more in the general template format that ASP.NET Core uses.

提交回复
热议问题