Showing posts with label NuGet. Show all posts
Showing posts with label NuGet. Show all posts

Wednesday, April 27, 2016

NuGet Package Source Blank After VS.NET Update

I recently updated VS.NET 2015 to Update 2 which was just released, but hit a snag with NuGet. Upon opening VS.NET and trying to download NuGet packages, I kept getting errors that the package didn't exist. I noticed the "Package source" dropdown was blank and had no selectable values. Even if I went to the VS.NET options for NuGet, I could no longer see the default nuget.org package source configured. Something must of went awry during the VS.NET update.

Thanks to a nudge from this Connect report, the recommendation was to update the NuGet package manager from the 'Extension and Updates' menu. Sure enough there was an update, and after installing and restarting VS.NET, the "Package source' values were once again populated with nuget.org and I could download packages.


Wednesday, May 22, 2013

Download and Export NuGet Packages Without VS.NET

99.999% of the NuGet packages that I use are associated with a specific project in VS.NET and adding them with the Package Manager Console is trivial.  Just copy and paste the command from the NuGet site, and your done.

Interestingly enough though I came across a couple of utilities I wanted to use that were hosted on NuGet that were not application specific; specifically 'OpenCover' and 'ReportGenerator'. These are used for unit testing code coverage metrics and reporting, so I thought they needed to be added to my unit test project. After seeing how they worked I realized they had nothing to do with any project and could be downloaded independently. I can still use VS.NET to download the packages and then move them, but why clutter my app with packages that are truly not required.

There is an easy enough way to download NuGet packages separate from VS.NET and export their contents to any given directory. One method I want to show you is a quick way to download a package from NuGet without any tooling at all, and just using the browser. Find the name of your package from NuGet and append it on to the end of this URL:

http://packages.nuget.org/api/v1/package/{package name}
and then add the package to make the complete download URL like this:
http://packages.nuget.org/api/v1/package/OpenCover



Which will immediately result in the download of the .nupkg NuGet package:



Now that's a quick and easy way to get the NuGet package without VS.NET. However there is a more inclusive tool named 'NuGet Package Explorer' available from CodePlex which allows us to download and export directly. This tool can be downloaded from the following link:


NuGet Package Explorer

It's a ClickOnce package and once installed there should be a desktop icon to launch the tool:



The easier way to download a package is to select 'Open a package from online feed' from the dialog presented upon opening the application. However if you already have the package downloaded you can select the 'Open a local package' link instead:



Search for the package you wish to download and extract:



Once you select the package you are looking for and press 'OK', the package's contents will be shown. Go to FILE -> Export where you can select the export location of the package:



Upon successful export of the NuGet package you should see the following message:



Lastly, navigate to the export location you selected and verify the contents of the NuGet package exist:



That's it! There is other functionality of the Package Explorer that includes making your own NuGet package as well. However it is possible to download and easily export the contents of a NuGet package without using VS.NET.

Thursday, May 17, 2012

Fixing The SignatureMismatchException When Updating NuGet

Recently I was trying to update the NuGet Package Manager for VS.NET 2010 from version 1.6.x to 1.7.x and ran across the following exception in the log presented when there is an error with the update process:

VSIXInstaller.SignatureMismatchException: The installed version of 'NuGet Package Manager' is signed, but the update version has an invalid signature. Therefore, Extension Manager cannot install the update. at VSIXInstaller.Common.VerifyMatchingExtensionSignatures(IInstalledExtension installedExtension, IInstallableExtension updateExtension) at VSIXInstaller.InstallProgressPage.BeginInstallVSIX(SupportedVSSKU targetAppID)
Install Error : VSIXInstaller.SignatureMismatchException: The installed version of 'NuGet Package Manager' is signed, but the update version has an invalid signature. Therefore, Extension Manager cannot install the update at. VSIXInstaller.Common.VerifyMatchingExtensionSignatures(IInstalledExtension installedExtension, IInstallableExtension updateExtension) at VSIXInstaller.InstallProgressPage.BeginInstallVSIX(SupportedVSSKU targetAppID)


The fix is simple; it requires an uninstall and reinstall. I assume updates within a version would work, but since I am actually upgrading I imagine this is what requires the uninstall 1st.

Go back to the Extension Manager and select "Installed Extensions", and then select the NuGet pacakage and press "Uninstall". Close and reopen the Extension Manager to refresh the installed packages, and search the Online Gallery for NuGet. If ordering by "Highest Ranked" it typically is the 1st or close to 1st item in the list. Now select "Download" and the installation will complete successfully.