Skip to content

Instantly share code, notes, and snippets.

@dcrosby42
Created February 1, 2011 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcrosby42/805470 to your computer and use it in GitHub Desktop.
Save dcrosby42/805470 to your computer and use it in GitHub Desktop.
Sample MSBuild file for running MigratorDotNet migrations
<Project DefaultTargets="All" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<UsingTask AssemblyFile="Lib\Migrator.MSBuild.dll" TaskName="Migrator.MSBuild.Migrate" />
<PropertyGroup>
<To>-1</To>
<Env>Development</Env>
<ConnectionString Condition="'$(Env)'=='Development'">Database=myapp_dev;Data Source=localhost;User Id=myuser;Password=abc123</ConnectionString>
<ConnectionString Condition="'$(Env)'=='Test'">Database=myapp_test;Data Source=test_db_server;User Id=myuser;Password=abc123</ConnectionString>
<ConnectionString Condition="'$(Env)'=='Production'">Database=myapp_prod;Data Source=prod_db_server;User Id=myuser;Password=abc123</ConnectionString>
</PropertyGroup>
<Target Name="Migrate" DependsOnTargets="Compile">
<SetEnvVar Variable="MigrationConnectionString" Value="$(ConnectionString)"/>
<Migrate Provider="SqlServer"
Connectionstring="$(ConnectionString)"
Migrations="MyApp\bin\MyApp.dll"
To="$(To)">
</Migrate>
</Target>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment