Environment specific EF6 Code First Migrations using VSTS Release
<p>I have a project that uses Entity Framework 6.x, ASP .NET WebApi 5.x. Data Access is in a secondary project inside the solution. I want to use VSTS (aka Visual Studio Online) to build and release it as a website to environments for integration/dev, qa, stage, and production. There are some great videos on Channel 9 that deal with the generic high-level description. (for example <a href="https://channel9.msdn.com/Series/DevOps-Release-Management" rel="nofollow noreferrer">https://channel9.msdn.com/Series/DevOps-Release-Management</a> and <a href="https://channel9.msdn.com/Series/DevOps-Fundamentals/Infrastructure-as-Code" rel="nofollow noreferrer">https://channel9.msdn.com/Series/DevOps-Fundamentals/Infrastructure-as-Code</a>) There are all kinds of articles and videos about how to do migrations from inside Visual Studio including generating scripts. </p>

<p>Searching around the web I don't even find any older resources or concrete examples of continuous deployment with code first migrations. There <strong>must</strong> be examples and best practices for methods other than auto-migrations or SQL scripts.</p>

<p>I have configured a Web Deployment Package publish profile. I use it via the <code>PublishProfile</code> msbuild.exe directive. The package is added to the artifacts and then deployed by the Azure Web App Deployment task in each Release environment. However once this package is built, I don't know of a way of changing the connection string in the build package for each time it is released to an environment.</p>

<p>There is probably something I am overlooking, but how should environment specific migrations be done with via VSTS Release?</p>