Project 'Default' not found error when installing a NuGet package
Asked Answered
C

11

29

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

Caesarea answered 20/7, 2016 at 16:50 Comment(0)
K
34

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

enter image description here

Klemm answered 4/1, 2017 at 18:2 Comment(2)
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...Ieshaieso
I don't have anything listed in "Default project". I am using CMake. Probably yet another missing integration in VS IDE. :(Beadruby
B
19

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

Brindled answered 22/10, 2017 at 1:1 Comment(4)
worked for me too... the drop down as completely emptyAcidhead
The usual solution to everything!Vain
@MarcoRebsamen Are you using an SLN to manage your project or something else (e.g. cmake)?Beadruby
@Beadruby I don't know what any of that means, so I guess I don't.Acidhead
W
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

Weihs answered 8/1, 2019 at 21:25 Comment(0)
L
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:

Landward answered 20/7, 2016 at 17:47 Comment(2)
You also get "Project 'Default' not found" when you have build errors ... fix the build errors, problem goes away.Palmette
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.Monosyllable
N
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
Nuriel answered 18/3, 2017 at 19:21 Comment(0)
D
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.

Dewaynedewberry answered 20/2, 2017 at 12:19 Comment(0)
T
0

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

Twittery answered 15/9, 2017 at 9:36 Comment(0)
N
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 .

Niedersachsen answered 3/6, 2022 at 6:28 Comment(0)
R
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

Rhettrhetta answered 19/7, 2022 at 16:56 Comment(0)
M
0

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

Mineralogy answered 25/7, 2024 at 11:45 Comment(0)
P
-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.

Palmette answered 10/10, 2016 at 21:35 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.