azure - Add Fluent Migrator Migrate step after Team Foundation Service build has finished -
i have asp.net mvc4 app , i'm using hosted team foundation service automate builds , deploy azure website.
this works great except deploying database changes.
i'm using fluent migrator specify changes database , have custom implementation of idatabaseinitializer when entity framework context spins up, migrations necessary. leaves database migration until 'first run' of application rather build , deploy.
what i'd able build attempt migration before deploys azure (and therefore fail build if there's problem migration).
is possible hosted build service? can add post-build steps can self hosted inhouse tfs?
add following .csproj file:
<usingtask taskname="fluentmigrator.msbuild.migrate" assemblyfile="$(msbuildprojectdirectory)\fluentmigrator.msbuild.dll" /> <target name="migrate"> <message text="migrating database" /> <migrate database="sqlserver" connection="your connection string" target="$(intermediateoutputpath)your dll name.dll"> </migrate> </target> also make sure target added after build target so:
<project toolsversion="4.0" defaulttargets="build;migrate;test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> you may have noticed load msbuild task project directory. copied fluentmigrator.msbuild.dll , fluentmigrator.runner.dll assemblies project folder. when tried load assemblies packages folder got error saying assemblies not in correct format...
Comments
Post a Comment