Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install NuGet package on a blank solution in Visual Studio 2015

At my company we have a NuGet package that, when applied on a blank Visual Studio solution, will generate a solution template with a predefined set of properly named and configured projects. We install the package by just executing the regular Install-package command in the package manager console.

However this seems to have been stopped working in Visual Studio 2015. If I try to install the package I get this error:

install-package : Project 'Default' is not found.
At line:1 char:1
+ install-package (The package name)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Default:String) [Install-Package], ItemNotFoundException
    + FullyQualifiedErrorId : NuGetProjectNotFound,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

What puzzles me is that this was working fine in Visual Studio 2013. I have been looking for information about this behavior but I haven't seen it mentioned nor reported as a bug anywhere.

Does anyone know what is happening here? Is it a bug? Is it a change in the way NuGet works in VS 2015?

By the way, if it matters, the VS 2013 edition I am using is Professional, while the VS 2015 edition is Community.

like image 404
Konamiman Avatar asked Jul 23 '15 13:07

Konamiman


People also ask

How do I add a NuGet package to Visual Studio 2015?

To install it individually in Visual Studio Installer, select the Individual components tab, and then select NuGet package manager under Code tools . For Visual Studio 2015, if you're missing the NuGet Package Manager, check Tools > Extensions and Updates and search for the NuGet Package Manager extension.

How do I force a NuGet package to Install?

Switch to the Browse tab, search for the package name, select it, then select Install). For all packages, delete the package folder, then run nuget install . For a single package, delete the package folder and use nuget install <id> to reinstall the same one.

Why is manage NuGet packages disabled?

The Add NuGet packages menu will be disabled if a project is not selected in the Solution window. Which is my guess as to why it is disabled for you. Update and Restore NuGet packages is available if a solution or project is selected.

How do I fix a missing NuGet package?

In Tools -> Options -> NuGet Package Manager -> General you need to select the "Allow NuGet to download missing packages" option which allows NuGet to restore and the "Automatically check for missing packages during build in Visual Studio" which enables on build restore.


1 Answers

It seems that solution level packages are deprecated in Visual Studio 2015, so no real solution for this.

like image 101
Konamiman Avatar answered Jan 02 '23 07:01

Konamiman