Updating Microsoft.NETCore.App to v1.1.0 causes -2

2019-04-23 03:06发布

问题:

I created a new .NET Core project in Visual Studio 2015 by following the instructions at: https://www.microsoft.com/net/core#windowsvs2015

It works OK, and I can add breakpoints etc. no problem.

Then I ran Tools->NuGet Package Manager->Manage NuGet Packages for Solution...

I got the option to update Microsoft.NETCore.App to the latest stable release v1.1.0.

The first issue I got was the error:

Can not find runtime target for framework '.NETCoreApp,Version=v1.0' compatible with one of the target runtimes: 'win10-x64, win81-x64, win8-x64, win7-x64'.

This appeared to be due to the update removing lines from the project.json, so I added the missing lines back in and changed the version to 1.1.0, so my project.json now looks like this:

{
  "version": "1.0.0-*",
  "buildOptions": {
    "emitEntryPoint": true
  },

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

  "frameworks": {
    "netcoreapp1.0": {
      "imports": "dnxcore50"
    }
  }
}

The program then built without issue, but when I run the program I get the Error:

The program '[13048] dotnet.exe' has exited with code -2147450749 (0x80008083).

Any ideas?

回答1:

Thanks to Adrien for providing the solution.

In the package Manager Console I ran the command:

dotnet --info

Response was:

.NET Command Line Tools (1.0.0-preview2-003131)

So I installed the .NET Core 1.1 SDK from:

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

Now I get the response:

.NET Command Line Tools (1.0.0-preview2-1-003177)

I think the versioning information is quite confusing as I don't see how this relates to 1.1.0, but the console application runs OK.

Thanks again.