9

For my current project i would prefer to update my database to the correct version on publish instead of first run via the App_Start.

It seems that there is support for manual upgrades via a commandline tool 'migrate.exe' which is supplied together with Entity Framework (5.0 rc2). But i can not find any information about how other people have combined this tool together with msdeploy to upgrade the database on publish instead of first run.

I have found the following page which explains how to use the migrate.exe tool: http://blog.overridethis.com/blog/post/2012/03/13/Automating-EF-43x-Data-Migrations-in-your-Build.aspx

But this forces me to somehow 'know' the connectionstring information.

My optimal solution would be something like:

  1. connectionstring is configured in setParameters.xml file for replacement on publish
  2. on publish after publish of codebase migrate.exe gets called with correct connectionstring

It seems that what i search for is an 'entity framework MSDeploy provider' (see: http://blogs.msdn.com/b/adonet/archive/2012/01/12/ef-4-3-beta-1-released.aspx) but it seems that they abandoned that option some time ago

1
  • You can let your migration to generate SQL script for upgrade and use that script when publishing the web. I think it is currently not supported to run migrations during web deploy. Commented Aug 22, 2012 at 8:11

1 Answer 1

1

You have two options:

  1. Configure Visual Studio Databases option in the Publish Profile; or
  2. Configure your project properties on Package/Publish SQL Tab.

I didn't use any of them yet but I was researching because I'll have the exactly same scenario.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.