Skip to content

Instantly share code, notes, and snippets.

@eralston
Last active December 21, 2015 05:39
Show Gist options
  • Save eralston/6258881 to your computer and use it in GitHub Desktop.
Save eralston/6258881 to your computer and use it in GitHub Desktop.
The commands for common package manager console tasks for ASP.Net MVC web app projects, such as migration of Code-First Entity Framework
///
/// UPDATE NuGET PACKAGES
///
Once a project is created, be sure to run "update-packages" to get the latest version of each package
///
/// To ensure NuGet packages are working on teammate machines:
/// Go tools -> Options -> Package Manager -> General
/// Check "Allow NuGet to download missing packages during build
/// Right click on the project solution
/// Select "Enable NuGet Package Restore"
///
///
/// CODE-FIRST MIGRATIONS
/// For managing changes in the Entity Framework database
///
1. Open the Package Manager Console
2. Run the command "enable-migrations" when first starting the project
3. Run the command "add-migration [NAME]" whenever you want to make a migration for current changes
4. Run the command "update-database" whenever you want to apply migrations or run the seed method
5. Run the command "update-database -ProjectName MvcMovie -StartUpProjectName MvcMovie.Tests" where MvcMovie is replaced with the project name when you want to migrate test project databases
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment