Troubleshooting NuGet failing to load
Today I had the unfortunate circumstance for VS2010 to crash whilst I was working, nothing to big I thought, I've had this happen before.
I reopened VS went to open my solution and got the following message:
---------------------------
Microsoft Visual Studio
---------------------------
The 'NuGet.Tools.NuGetPackage, NuGet.Tools, Version=1.6.21215.9133, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' package did not load correctly.
EEK!
Nuget is smegged :( I immediately thought to uninstall the extension and then reinstall it, same thing happened :(
I then, (looking back this was foolish as NuGet is shared), thought I know I just load it in VS11 that will work, it also errored.
Not cool, the error message however directs you to start VS with logging enabled by using the /log command argument and then to look at the activity log. The activity log is located in your appdata roaming folder, simply stick %appdata%\Microsoft\VisualStudio\10.0\ActivityLog.xml into run or %appdata%\Microsoft\VisualStudio\11.0\ActivityLog.xml dependant on your VS version. This will then load a load of XML with the VS loading activity in it. After a bit of scrolling I came across this:
To restore the file you just need to put in the location of package sources NuGet should use, the default is:
Phew
A bit of a pain but the experience lead me to learning about the VS activity log which I'm sure will be useful to know in the future. Now time to get back on with my project....
I reopened VS went to open my solution and got the following message:
---------------------------
Microsoft Visual Studio
---------------------------
The 'NuGet.Tools.NuGetPackage, NuGet.Tools, Version=1.6.21215.9133, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' package did not load correctly.
EEK!
Nuget is smegged :( I immediately thought to uninstall the extension and then reinstall it, same thing happened :(
I then, (looking back this was foolish as NuGet is shared), thought I know I just load it in VS11 that will work, it also errored.
Not cool, the error message however directs you to start VS with logging enabled by using the /log command argument and then to look at the activity log. The activity log is located in your appdata roaming folder, simply stick %appdata%\Microsoft\VisualStudio\10.0\ActivityLog.xml into run or %appdata%\Microsoft\VisualStudio\11.0\ActivityLog.xml dependant on your VS version. This will then load a load of XML with the VS loading activity in it. After a bit of scrolling I came across this:
<entry>The key information here is the invalid character and the NuGet.VisualStudio.VsSettings. This looks like the NuGet.Config is corrupt, the next question is where is it. Turns out this is also in app data %appdata%\nuget\ Once here I opened the file in notepad and found it was empty all bar the Unicode start file character.
<record>505</record>
<time>2012/03/21 09:49:33.568</time>
<type>Error</type>
<source>VisualStudio</source>
<description>SetSite failed for packageSetSite failed for package</description>
<guid>{5FCC8577-4FEB-4D04-AD72-D6C629B083CC}</guid>
<hr>80131500</hr>
<errorinfo>The composition produced a single composition error, with 2 root causes. The root causes are provided below. Review the CompositionException.Errors property for more detailed information. 1) '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1. Resulting in: An exception occurred while trying to create an instance of type 'NuGet.VisualStudio.VsSettings'.
Resulting in: Cannot activate part 'NuGet.VisualStudio.VsSettings'.
Element: NuGet.VisualStudio.VsSettings --> NuGet.VisualStudio.VsSettings --> CachedAssemblyCatalog
Resulting in: Cannot get export 'NuGet.VisualStudio.VsSettings (ContractName="NuGet.ISettings")' from part 'NuGet.VisualStudio.VsSettings'.
Element: NuGet.VisualStudio.VsSettings (ContractName="NuGet.ISettings") --> CachedAssemblyCatalog
.........… rest removed due to length .........
</errorinfo>
</entry>
To restore the file you just need to put in the location of package sources NuGet should use, the default is:
<?xml version="1.0" encoding="utf-8"?>Once this was saved I tried running NuGet via the command prompt and got the familiar available commands listing.
<configuration>
<packageSources>
<add key="NuGet official package source" value="https://go.microsoft.com/fwlink/?LinkID=230477" />
</packageSources>
<activePackageSource>
<add key="NuGet official package source" value="https://go.microsoft.com/fwlink/?LinkID=230477" />
</activePackageSource>
</configuration>
Phew
A bit of a pain but the experience lead me to learning about the VS activity log which I'm sure will be useful to know in the future. Now time to get back on with my project....
Very nice, love it when we're forced to debug VS... I've never had this particular problem with nuget, had others though :)
ReplyDelete