[英]Nuget not working after Windows Refresh (Windows 10 / VS2015 Community)
由於Surface pro 3中的某些網卡問題,我將Windows 10安裝刷新到幾天前(大約一周)的PC狀態。 據推測,此選項僅更改設置和安裝(注冊表項,已安裝的軟件等)。
之后,我無法讓Nuget在Visual Studio上正常工作。 症狀如下:如果在依賴性解析和添加文件之后添加了軟件包(例如MVVMLight),這就是我在控制台中看到的內容:
Executing script file 'C:\Users\Erick\Documents\Projects\test\packages\MvvmLight.5.2.0.0\tools\install.ps1'...
null : The term 'null' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At C:\Users\Erick\Documents\Projects\test\packages\MvvmLight.5.2.0.0\tools\install.ps1:160 char:15
+ $resources = null
+ ~~~~
+ CategoryInfo : ObjectNotFound: (null:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Locator
#text
-----
True
Successfully installed 'MvvmLight 5.2.0' to Cierre de Eventos
========== Finished ==========
項目中的packages.config文件已正確更新:
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="1.3" targetFramework="net46" />
<package id="MvvmLight" version="5.2.0.0" targetFramework="net46" />
<package id="MvvmLightLibs" version="5.2.0.0" targetFramework="net46" />
</packages>
然后創建packages文件夾,並在其中包含這些軟件包。 關鍵是在每個包文件夾中,例如MvvmLight.5.2.0.0,我只看到:
Content (Folder)
tools (Folder)
MvvmLight.5.2.0.0.nupkg
MvvmLight.5.2.0.nupkg
沒有lib文件夾,當然也沒有MvvmLight.5.2.0.0.dll! 由於從未提取過任何dll,因此不會將其添加到項目的引用中...
另外,在根目錄中也沒有.nuget文件夾...我知道在我的舊版VS項目中,有一個.nuget文件夾,但是我不確定Nuget是否能繼續工作(如VS2015) /最新版本的Nuget)。
使用FirebirdSql.Data.FirebirdClient.4.7.0.0之類的程序包,在控制台中沒有得到任何與“ null”相關的錯誤,創建了lib文件夾,但是在net45文件夾中只有調試文件FirebirdSql.Data .FirebirdClient.pdb,沒有dll ...
因此,我已經卸載/重新安裝了nuget,卸載/重新安裝了Visual Studio,仍然存在相同的問題...我該怎么做才能解決此問題?
這看起來像是MvvmLight 5.2 install.ps1 PowerShell腳本中的錯誤。 如果使用NuGet軟件包管理器控制台安裝MvvmLight 5.2,則會看到相同的錯誤。
出現錯誤的行有:
$resources = null
什么時候應該是:
$resources = $null
使用不帶美元符號前綴的null
無效,PowerShell無效。 如果嘗試直接在PowerShell中運行$resources = null
行,您將看到與NuGet報告相同的錯誤。
我將其報告為針對MvvmLight的錯誤。
一種解決方法是下載MvvmLight NuGet程序包,然后使用zip文件編輯器(例如7zip),編輯install.ps1文件並修復錯誤的PowerShell。 然后,您可以設置一個包源,該包源指向包含.nupkg文件的目錄,並從那里安裝它而不會出現任何錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.