Cobus Kruger
Cobus Kruger

Reputation: 8615

Nuget can't update .NET Core project

I installed .NET Core and created a new VS2015 project using the ASP.NET Core Web Application (.NET Core) template.

This basic project compiles and runs just fine and it doesn't have any weird errors under the References section.

The NuGet package manager UI however identifies thirteen updates. Boldly/Naively I executed this command on the PM console:

Update-Package

It outputs this nice long list of success messages shown right at the bottom of this question (for brevity) and updates the version numbers in project.json.

Here's the dependencies section of project.json:

  "dependencies": {
    "Microsoft.ApplicationInsights.AspNetCore": "1.0.2",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Routing": "1.1.0",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.NETCore.App": {
      "version": "1.1.0",
      "type": "platform"
    }
  },

In Solution Explorer though, the package versions are not updated.

enter image description here

When I rebuild, I get reams of warnings, all in this format:

warning NU1007: Dependency specified was Microsoft.AspNetCore.Mvc >= 1.1.0 but ended up with Microsoft.AspNetCore.Mvc 1.0.1.

I don't understand why NuGet would update package.json, but not the project references. Moreover, I don't see how to fix it by hand. While project.json is updated, project.lock.json is not, but changing the version numbers there by hand causes the warnings to change into errors in the form:

NU1001  The dependency Microsoft.Extensions.Logging.Console >= 1.1.0 could not be resolved.

I'm using VS2015 Update 3 and NuGet 3.5.

My questions then:

  1. Is there a way to force NuGet to update the project references so I won't get these warnings?
  2. Any idea why this happens?
  3. Is there a reliable workaround (like manually editing some files)?

Here is the output from Update-Package:

Retrieving package 'Microsoft.ApplicationInsights.AspNetCore 1.0.2' from 'nuget.org'.
Retrieving package 'Microsoft.AspNetCore.Mvc 1.1.0' from 'nuget.org'.
Retrieving package 'Microsoft.AspNetCore.Routing 1.1.0' from 'nuget.org'.
Retrieving package 'Microsoft.AspNetCore.Server.IISIntegration 1.1.0' from 'nuget.org'.
Retrieving package 'Microsoft.AspNetCore.Server.Kestrel 1.1.0' from 'nuget.org'.
Retrieving package 'Microsoft.Extensions.Configuration.EnvironmentVariables 1.1.0' from 'nuget.org'.
Retrieving package 'Microsoft.Extensions.Configuration.FileExtensions 1.1.0' from 'nuget.org'.
Retrieving package 'Microsoft.Extensions.Configuration.Json 1.1.0' from 'nuget.org'.
Retrieving package 'Microsoft.Extensions.Logging 1.1.0' from 'nuget.org'.
Retrieving package 'Microsoft.Extensions.Logging.Console 1.1.0' from 'nuget.org'.
Retrieving package 'Microsoft.Extensions.Logging.Debug 1.1.0' from 'nuget.org'.
Retrieving package 'Microsoft.Extensions.Options.ConfigurationExtensions 1.1.0' from 'nuget.org'.
Retrieving package 'Microsoft.NETCore.App 1.1.0' from 'nuget.org'.
Uninstalling NuGet package Microsoft.ApplicationInsights.AspNetCore.1.0.0.
Successfully uninstalled 'Microsoft.ApplicationInsights.AspNetCore.1.0.0' from WebApplication3
Installing NuGet package Microsoft.ApplicationInsights.AspNetCore.1.0.2.
Successfully installed 'Microsoft.ApplicationInsights.AspNetCore 1.0.2' to WebApplication3
Uninstalling NuGet package Microsoft.AspNetCore.Mvc.1.0.1.
Successfully uninstalled 'Microsoft.AspNetCore.Mvc.1.0.1' from WebApplication3
Installing NuGet package Microsoft.AspNetCore.Mvc.1.1.0.
Successfully installed 'Microsoft.AspNetCore.Mvc 1.1.0' to WebApplication3
Uninstalling NuGet package Microsoft.AspNetCore.Routing.1.0.1.
Successfully uninstalled 'Microsoft.AspNetCore.Routing.1.0.1' from WebApplication3
Installing NuGet package Microsoft.AspNetCore.Routing.1.1.0.
Successfully installed 'Microsoft.AspNetCore.Routing 1.1.0' to WebApplication3
Uninstalling NuGet package Microsoft.AspNetCore.Server.IISIntegration.1.0.0.
Successfully uninstalled 'Microsoft.AspNetCore.Server.IISIntegration.1.0.0' from WebApplication3
Installing NuGet package Microsoft.AspNetCore.Server.IISIntegration.1.1.0.
Successfully installed 'Microsoft.AspNetCore.Server.IISIntegration 1.1.0' to WebApplication3
Uninstalling NuGet package Microsoft.AspNetCore.Server.Kestrel.1.0.1.
Successfully uninstalled 'Microsoft.AspNetCore.Server.Kestrel.1.0.1' from WebApplication3
Installing NuGet package Microsoft.AspNetCore.Server.Kestrel.1.1.0.
Successfully installed 'Microsoft.AspNetCore.Server.Kestrel 1.1.0' to WebApplication3
Uninstalling NuGet package Microsoft.Extensions.Configuration.EnvironmentVariables.1.0.0.
Successfully uninstalled 'Microsoft.Extensions.Configuration.EnvironmentVariables.1.0.0' from WebApplication3
Installing NuGet package Microsoft.Extensions.Configuration.EnvironmentVariables.1.1.0.
Successfully installed 'Microsoft.Extensions.Configuration.EnvironmentVariables 1.1.0' to WebApplication3
Uninstalling NuGet package Microsoft.Extensions.Configuration.FileExtensions.1.0.0.
Successfully uninstalled 'Microsoft.Extensions.Configuration.FileExtensions.1.0.0' from WebApplication3
Installing NuGet package Microsoft.Extensions.Configuration.FileExtensions.1.1.0.
Successfully installed 'Microsoft.Extensions.Configuration.FileExtensions 1.1.0' to WebApplication3
Uninstalling NuGet package Microsoft.Extensions.Configuration.Json.1.0.0.
Successfully uninstalled 'Microsoft.Extensions.Configuration.Json.1.0.0' from WebApplication3
Installing NuGet package Microsoft.Extensions.Configuration.Json.1.1.0.
Successfully installed 'Microsoft.Extensions.Configuration.Json 1.1.0' to WebApplication3
Uninstalling NuGet package Microsoft.Extensions.Logging.1.0.0.
Successfully uninstalled 'Microsoft.Extensions.Logging.1.0.0' from WebApplication3
Installing NuGet package Microsoft.Extensions.Logging.1.1.0.
Successfully installed 'Microsoft.Extensions.Logging 1.1.0' to WebApplication3
Uninstalling NuGet package Microsoft.Extensions.Logging.Console.1.0.0.
Successfully uninstalled 'Microsoft.Extensions.Logging.Console.1.0.0' from WebApplication3
Installing NuGet package Microsoft.Extensions.Logging.Console.1.1.0.
Successfully installed 'Microsoft.Extensions.Logging.Console 1.1.0' to WebApplication3
Uninstalling NuGet package Microsoft.Extensions.Logging.Debug.1.0.0.
Successfully uninstalled 'Microsoft.Extensions.Logging.Debug.1.0.0' from WebApplication3
Installing NuGet package Microsoft.Extensions.Logging.Debug.1.1.0.
Successfully installed 'Microsoft.Extensions.Logging.Debug 1.1.0' to WebApplication3
Uninstalling NuGet package Microsoft.Extensions.Options.ConfigurationExtensions.1.0.0.
Successfully uninstalled 'Microsoft.Extensions.Options.ConfigurationExtensions.1.0.0' from WebApplication3
Installing NuGet package Microsoft.Extensions.Options.ConfigurationExtensions.1.1.0.
Successfully installed 'Microsoft.Extensions.Options.ConfigurationExtensions 1.1.0' to WebApplication3
Uninstalling NuGet package Microsoft.NETCore.App.1.0.1.
Successfully uninstalled 'Microsoft.NETCore.App.1.0.1' from WebApplication3
Installing NuGet package Microsoft.NETCore.App.1.1.0.
Successfully installed 'Microsoft.NETCore.App 1.1.0' to WebApplication3
Executing nuget actions took 729.79 ms
Time Elapsed: 00:00:08.2056394

Upvotes: 3

Views: 2622

Answers (1)

J. Doe
J. Doe

Reputation: 2747

Do you tried dotnet restore?

Second thing is do you have newest .Net Core. Try to download and install lastest relase of SDK

Upvotes: 4

Related Questions