Nuget无法更新.NET Core项目

时间:2016-12-12 12:33:59

标签: visual-studio visual-studio-2015 asp.net-core nuget .net-core

我安装了.NET Core并使用 ASP.NET核心Web应用程序(.NET Core)模板创建了一个新的VS2015项目。

这个基础项目编译并运行得很好,并且在“参考”部分下没有任何奇怪的错误。

然而,NuGet包管理器UI识别出13个更新。 Boldly / Naively我在PM控制台上执行了这个命令:

Update-Package

它会在此问题的底部(为简洁起见)输出显示的成功消息,并更新project.json中的版本号。

这是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"
    }
  },

在解决方案资源管理器中,软件包版本更新。

enter image description here

当我重建时,我会收到大量警告,所有这些格式都是:

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

我不明白为什么NuGet会更新package.json,而不是项目引用。而且,我不知道如何手工修复它。更新project.json时,project.lock.json不会更新,但手动更改版本号会导致警告更改为以下格式的错误:

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

我正在使用VS2015 Update 3和NuGet 3.5。

我的问题是:

  1. 有没有办法强制NuGet更新项目引用,所以我不会收到这些警告?
  2. 知道为什么会这样吗?
  3. 是否有可靠的解决方法(比如手动编辑某些文件)?
  4. 以下是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
    

1 个答案:

答案 0 :(得分:4)

你试过dotnet restore吗?

第二件事是你有最新的.Net Core。尝试下载并安装最新版本的SDK