繁体   English   中英

Windows刷新后Nuget无法正常工作(Windows 10 / VS2015社区)

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM