30

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

12 Answers 12

35

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

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

Indeed that seems pretty logic, some errors are sometimes so obvious... I don't know if I should laugh or if I should cry... Same thing happened to me recently with 'Add-Migration' command' with EF CORE 1.0. I then realized no project had been selected in Default Project console droplist [sigh...]. Just selected the name of the project and I could then proceed with migration and then update... Thanks...
I don't have anything listed in "Default project". I am using CMake. Probably yet another missing integration in VS IDE. :(
20

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

4 Comments

worked for me too... the drop down as completely empty
The usual solution to everything!
@MarcoRebsamen Are you using an SLN to manage your project or something else (e.g. cmake)?
@rbaleksandar I don't know what any of that means, so I guess I don't.
5

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

Comments

2

try this:

  1. Open a command prompt in the root source directory of your application (where "project.json" is)
  2. Run

    dotnet ef migrations add MyFirstMigration
    

    and

    dotnet ef database update
    

For your packages try to edit your "project.json" file and add new dependencies and run:

dotnet restore

Look at:

2 Comments

You also get "Project 'Default' not found" when you have build errors ... fix the build errors, problem goes away.
This worked for me. I can also type those same commands in PM console and they work but the original commands do not work in the console.
1

that nuget you want to install is not compatible with current project framework

  • right click on project name at solution explorer panel and choose properties
  • in the application tab change target framework to newest one.
  • close and try again to install-package

Comments

1

The fix for me was to open project with the .sln solution file. Initially I had initially opened my project with the 'Open Folder' option, which caused the "Project 'Default' not found" error when trying to install packages.

Comments

0

It could happen when your project’s path is too long. Simply rename folder to shorter one or move your solution to another place.

Comments

0

In my case this happens after removing of "Applications insight for VS2015". Installing back of "Applications insight for VS2015" fixed the issue.

Comments

0

In some cases, if we close the project and open it again, the problem will be solved . The reason is that the migration command is not reloaded, thanks to Visual Studio .

Comments

0

I had an issue where I installed some packages already but they weren't working. Naturally, I tried to re-install the packages and the same error came up for me. Turns out; problem was me not opening the .sln (solution) file.

Its Important to point out that you have to load your project through the .sln file or you'll probably get the Project "Default" is not found error. One solution on here says to

I fixed this by closing down VS and reopening the solution. - @Preye.

While it worked for me, it confused me at first because I thought it meant to reopen the project. I had to open the project by means of the solution file.

This is an error on NuGet's GitHub:

Error installing package to PowerShell project with poor error

Comments

0

I got the same error trying to use NuGet as my package manager for a project that is not .NET

Comments

-1

You also get this message when your project has build errors ... Package manager Console does a build.

Fix the build errors and "project 'Default' not found" goes away.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.