简体   繁体   English

NuGet包在Visual Studio 2015中不起作用

[英]NuGet Package Not working in Visual Studio 2015

After updating Visual studio 2015, I am getting the following error when visual studio starts. 更新Visual Studio 2015后,我在visual studio启动时收到以下错误。 Nuget Operation failed NuGet.Config is not a valid XML. Nuget操作失败NuGet.Config不是有效的XML。 Path 路径

'.' '' hexadecimal value 0x00, is an invalid character. 十六进制值0x00,是无效字符。 Line 1, Position 1. 第1行,第1位。

Also, i cannot use the package manager console anymore. 此外,我不能再使用包管理器控制台了。

I tried uninstalling and reinstalling it, but with no success. 我尝试卸载并重新安装它,但没有成功。 i am still getting the error above. 我仍然得到上面的错误。

Any guidance on how to fix this would be appreciated, thanks! 任何关于如何解决这个问题的指导将不胜感激,谢谢!

Delete NuGet.Config from: 从以下位置删除NuGet.Config

C:\Users\your-username\AppData\Roaming\NuGet

Upon re-opening VS2015 a new config file will be created and the issue should be resolved. 重新打开VS2015后,将创建一个新的配置文件,并解决该问题。

Delete ".nuget" folder from C drive\\users\\username 从C drive \\ users \\ username中删除“.nuget”文件夹

C:\\Users\\{username}\\.nuget C:\\用户\\ {用户名} \\的NuGet

and you can update or re-install the package. 您可以更新或重新安装包。

This is work for me. 这对我有用。

Do you have any nuget.config file in your Solution? 您的解决方案中是否有任何nuget.config文件?

The format have changed from fx: 格式已从fx更改:

<settings>
  <repositoryPath>..\..\packages</repositoryPath>
</settings>

To: 至:

<configuration>
  <config>
    <add key="repositoryPath" value="..\..\packages" />
  </config>
</configuration>

Could be some of your packages have been cached? 你的一些软件包可能已被缓存了吗?

Download the latest nuget.exe (from https://dist.nuget.org/win-x86-commandline/latest/nuget.exe ) and open a command prompt ( preferably with administrator privileges ) and point to the location where you've download the nuget.exe and execute following commands (from command prompt or powershell console). 下载最新的nuget.exe(来自https://dist.nuget.org/win-x86-commandline/latest/nuget.exe )并打开命令提示符( 最好具有管理员权限 )并指向您所在的位置下载nuget.exe并执行以下命令(从命令提示符或powershell控制台)。

nuget.exe locals -clear global-packages
nuget.exe locals -clear http-cache
nuget.exe locals -clear temp

Then restart Visual Studio. 然后重新启动Visual Studio。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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