问题
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
回答1:
Such an error occured to me, I fixed it simply by choosing the project at the console
回答2:
Simple solution, but I just restarted VS 2017 and I was able to run the Add-Migration "XXXXXX" command.
回答3:
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
回答4:
try this:
- Open a command prompt in the root source directory of your application (where "project.json" is)
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:
- https://docs.efproject.net/en/latest/miscellaneous/cli/dotnet.html for the ef tool documentation.
- https://docs.microsoft.com/en-us/dotnet/articles/core/tools/dotnet-restore for the restore documentation.
- https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json#dependencies for the "project.json" documentation
回答5:
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
回答6:
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.
回答7:
It could happen when your project’s path is too long. Simply rename folder to shorter one or move your solution to another place.
回答8:
In my case this happens after removing of "Applications insight for VS2015". Installing back of "Applications insight for VS2015" fixed the issue.
来源:https://stackoverflow.com/questions/38486386/project-default-not-found-error-when-installing-a-nuget-package