0

Every time I want to update database with code-first migrations I need to open Package Manager Console, set up Default project to project where I have migrations and write command:

update-database -startupprojectname CoreConsole

How I can set up in my solution:

1) Default project in dropdown where migrations are stored

2) startupprojectname where config with connection settings is stored

The target is to only write command update-database in console without any parameters and additional dropdown selections.

Argnist
  • 535
  • 1
  • 5
  • 18
  • Are you using Entity framework (EFF) core or eff for .net framework ? also can you please let us know if you are using Asp.net mvc framework , or console app? – Umang Mar 28 '18 at 03:41
  • 1
    The PMC stores the last selected project (selected in PMC) when closing/loading the solution. Did you try to select it by combobox? As another solution - just create your own powershell cmdlet. the pmc is just a powershell, so creating your own powershell cmdlets makes them available in the pmc. – dsdel Mar 28 '18 at 05:09
  • @Umang .NET Framework console app – Argnist Mar 28 '18 at 06:41
  • @dsdel Default project in combobox sometimes select entry point console app but migrations are in another project. +1 for powershell script – Argnist Mar 28 '18 at 06:47
  • By further research found as duplicate to [How do I permanently set a new Default project in the VS NuGet Package Manager console?](https://stackoverflow.com/questions/10388157/how-do-i-permanently-set-a-new-default-project-in-the-vs-nuget-package-manager-c) – dsdel Mar 28 '18 at 08:07
  • @Argnist I have posted in the other thread a workaround by using global variables and a msdn link to the nuget powershell profile – dsdel Mar 28 '18 at 08:15

0 Answers0