我安裝了.NET Core,並使用ASP.NET核心Web應用程序(.NET Core)模板創建了一個新的VS2015項目。Nuget無法更新.NET Core項目
這個基礎項目編譯和運行得很好,在參考文獻部分沒有任何奇怪的錯誤。
然而NuGet包管理器用戶界面標識了十三個更新。大膽地/我天真的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"
}
},
在Solution Explorer中雖然,包版本不更新。
當我重建,我得到的警告令,所有的格式如下:
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更新3和3.5的NuGet。
我的問題,然後:
- 有沒有辦法強制的NuGet更新項目引用,所以我不會得到這些警告?
- 任何想法爲什麼發生這種情況?
- 是否有可靠的解決方法(如手動編輯某些文件)?
下面是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
你試過'dotnet restore'嗎? (https://docs.microsoft.com/pl-pl/dotnet/articles/core/tools/dotnet-restore) 第二件事是你有最新的.Net核心。嘗試從https://www.microsoft.com/net/download/core#/current下載並安裝最新版本。 –
@ J.Doe我現在做了,它的工作原理!在NuGet據說完成工作後,我仍然不明白爲什麼甚至需要它,但這是另一天的問題。提交這個答案,我會接受它。 –
.NET Core for Visual Studio 2015的工具只是預覽版,所以它不會輕易使所有內容正常工作。我個人的建議是隻使用'dotnet'命令行,並避免使用像NuGet Package Manager這樣的.NET Core項目。 –