我遇到了一個問題,即無法安裝NuGet軟件包或更新軟件包,即使我以前能夠安裝這些軟件包。使用一個乾淨的解決方案,我可以創建一個ASP.NET MVC項目使用.NETFramework 4.5.2(我也試過4.6.1)。無法安裝適用於.NETFramework版本的軟件包
由於我採用默認身份驗證選項(個人用戶帳戶),Microsoft Owin包都包含在內,包括核心Owin包(這是Microsoft Owin包的依賴項)。如果我添加另一個項目(我從一個基本的類庫開始,但爲了測試的目的也嘗試了一個MVC項目而沒有驗證),我不能添加任何Owin相關的包,因爲Owin 1.0.0包失敗:
PM> Install-Package Owin
Attempting to gather dependencies information for package 'Owin.1.0.0' with respect to project 'Core', targeting '.NETFramework,Version=v4.5.2'
Attempting to resolve dependencies for package 'Owin.1.0.0' with DependencyBehavior 'Lowest'
Resolving actions to install package 'Owin.1.0.0'
Resolved actions to install package 'Owin.1.0.0'
Install failed. Rolling back...
Package 'Owin.1.0.0 : ' does not exist in project 'Core'
Install-Package : Could not install package 'Owin 1.0.0'. You are trying to install this package into a project that targets '.NETFramework,Version=v4.5.2', but the package does not contain any assembly referen ces or content files that are compatible with that framework. For more information, contact the package author.
At line:1 char:16
+ Install-Package <<<< Owin
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand PM>
腳手架項目使用.NetFramework 4.5.2,已經有Owin版本1.0.0工作沒有問題。
類似地,默認情況下包含響應。默認版本是1.2.0。
我可以使用NuGet Package Manager升級到版本1.4.1,而不會出現問題。但是,如果我嘗試升級到最新的穩定版本1.4.2,那麼我會得到與我在安裝Owin時完全相同的錯誤。
一位同事通過源代碼控制擁有同一項目的副本,他也在運行VS2015。他可以更新到回覆1.4.2。沒有問題。
另一位同事重複每一個測試,我嘗試了沒有遇到任何問題。
即使很奇怪,我可以在今天早上將Owin及其依賴關係添加到.NET類庫項目中(但我無法升級到最新的Respond版本)。但是在刪除解決方案並開始新解決方案之後,我開始遇到各種包的問題。
nuGet最近變得很糟糕 – Neil