Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NuGet Package Manager Console Default Project dropdown is empty

I recently upgraded to Visual Studio 2012 RTM Ultimate from MSDN. I'm using EF Code First Migrations to build my database in my app, and I recently added a new entity and want to scaffold the migration for it.

To do this, you need to open the Package Manage Console window in VS, and type add-migration "some name here". This will scaffold any changes to your database since the last time it was updated.


The Problem

This issue did not occur on VS 2012 RC

The problem I'm encountering is the "Default Project" dropdown in the Package Manager Console is not populated, despite having several projects in my solution. The default project that is used when I just type the command above is the wrong project (my migrations are in another project). I get the following error when I do this:

No migrations configuration type was found in the assembly 'ProjectA'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration).

Visual Studio 2012 Package Manager Console


What I've Tried

I have tried setting the correct project (ProjectB) as the startup project, only to get this error:

Could not load assembly 'ProjectA'. (If you are using Code First Migrations inside Visual Studio this can happen if the startUp project for your solution does not reference the project that contains your migrations. You can either change the startUp project for your solution or use the -StartUpProjectName parameter.)


The Question

How can I manually specify which project migrations are added to, or force the Default Project dropdown to populate?

like image 948
Kyle Trauberman Avatar asked Aug 19 '12 17:08

Kyle Trauberman


People also ask

How do I select a project in Package Manager console?

From Visual Studio, select Tools > NuGet Package Manager > Package Manager Console. After the Package Manager Console pane opens, verify that the Default project drop-down list shows the project in which you want to install the package. If you have a single project in the solution, it's preselected.

What is the default NuGet package source?

The default is %userprofile%\. nuget\packages (Windows) or ~/. nuget/packages (Mac/Linux). A relative path can be used in project-specific nuget.

How do I restore NuGet packages in Visual Studio Package Manager console?

In Visual Studio on Windows, you can restore packages automatically or manually. First, configure Package Restore through Tools > Options > NuGet Package Manager.


1 Answers

In VS 2015, I just restarted the IDE and the dropdown was filled again.

like image 180
danpop Avatar answered Sep 22 '22 19:09

danpop