Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project 'Default' not found error when installing a NuGet package

I copied the following project from win 8.1 to windows 7 and deleted the Migration folder. Now when I run PM> Add-Migration MyFirstMigration -context BloggingContext command in VS2015 I get the error: Project "Default" is not found. Both the machines have ASP.NET Core 1.0 and VS2015-Update 3 installed. I get the same error if I run Install-Package command for any package. Project runs fine on Win8.1

UPDATE

I do not have the same issue when copying a project from Windows 7 to Windows 8.1 or after I upgraded from windows 7 to Windows 10. Maybe, the above issue has something to do with copying a project from a higher version to lower version

like image 570
nam Avatar asked Jul 20 '16 16:07

nam


People also ask

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.

How do I Install missing NuGet packages in Visual Studio 2019?

Restore packages manually using Visual StudioEnable package restore by choosing Tools > Options > NuGet Package Manager. Under Package Restore options, select Allow NuGet to download missing packages. In Solution Explorer, right click the solution and select Restore NuGet Packages.

How do I import a NuGet package into a project?

Drop your NuGet package files in that folder. Go to your Project in Solution Explorer, right click and select "Manage NuGet Packages". Select your new package source.

How do I get NuGet packages in Visual Studio 2022?

Set up Visual StudioIn Visual Studio, select Tools, and then select Options. Select NuGet Package Manager, and then select Package Sources. Enter the feed's Name and Source URL, and then select the green (+) sign to add a new package source.


3 Answers

Such an error occured to me, I fixed it simply by choosing the project at the console

enter image description here

like image 133
Arun Prasad E S Avatar answered Oct 20 '22 09:10

Arun Prasad E S


Simple solution, but I just restarted VS 2017 and I was able to run the Add-Migration "XXXXXX" command.

like image 18
The Mob Avatar answered Oct 20 '22 10:10

The Mob


I fixed this by closing down VS and reopening the solution. Now I can install packages with Nuget.

Also someone said something about choosing the project from the drop-down as the default project, My drop-down was blank. In case the problem you are having is similar...try restarting the solution. Worked for me

like image 5
Preye Avatar answered Oct 20 '22 09:10

Preye