hi,
I want to run entity framework migrations using MSBuild and migrate.exe in continua CI.
But some how i am not able to copy migrate.exe from " $Workspace$\Source\GitRepository\packages\EntityFramework.6.1.1\tools " path to $Workspace$\Output folder.
I am using below link for reference,
http://www.gitshah.com/2014/06/how-to-run-entity-framework-migrations.html
Does anyone have idea about how we can achieve this in Continua CI.
Thanks in advance.
Hi,
You should be able to use Copy action to copy the migration tool. Set the Source Directory to $Workspace$\Source<span style=“background: #ffffff;”>GitRepository\packages\EntityFramework.6.1.1\tools, the File Names / Patterns to *.exe and Destination Path to $Workspace$\Output. Then use an Execute Program action to run $Workspace$\Output\Migrate.exe with the name of your dll or exe as an Argument.
If you have tried this and it has not worked then first enable logging for repository rules and workspace rules and then send the build log to support@finalbuilder.com, along with details of the relevant action settings, your repository settings, the workspace and repository rules, and any errors in the event log.
hi,
thanks for your reply.
Now I am able to copy migrate.exe to output folder And also tried to run that exe using MSBUILD action but getting below error,
MSBUILD : error MSB1009: Project file does not exist.
Switch: C:\CI_WS\Ws\177\Output\migrate.exe Migration.Data.dll
So not sure whether its possible to pass exe file in Project File text box of MSbuild Action.
Or Is there any other way to achieve this?
There’s a few ways to do this:
Option 1: As in my previous reply, you add three Continua actions:
Copy action Source Directory: $Workspace$\Source\GitRepository\packages\EntityFramework.6.1.1\tools File Names / Patterns: *.exe Destination Path: $Workspace$\OutputMSBuild action Project File: $Workspace$/Source/GitRepository/Migration.Data.csproj Output Path: $Workspace$\OutputExecute Program action Executable Path: $Workspace$\Output\Migrate.exe Working Directory: $Workspace$\Output Arguments: Migration.Data.dllOption 2: .First edit your project file e.g. Migration.Data.csproj and add the following Target:
<Target Name=“Migrate”> <exec Command="$(OutputPath)\migrate.exe Migration.Data.dll /verbose"/> Target>Then add two Continua actions:
Copy action Source Directory: $Workspace$\Source\GitRepository\packages\EntityFramework.6.1.1\tools File Names / Patterns: *.exe Destination Path: $Workspace$\OutputMSBuild action Project File: $Workspace$/Source/GitRepository/Migration.Data.csproj
Targets: build;migrate Output Path: $Workspace$\OutputOption3: First edit your project file e.g. Migration.Data.csproj and add the following Target:
<Target Name=“Migrate”> <copy SourceFiles="$(MigratorToolPath)\migrate.exe" DestinationFolder="$(OutputPath)" /> <exec Command="$(OutputPath)\migrate.exe MigrationsDemo.exe /verbose"/> Target>Then add one Continua action:
MSBuild action Project File: $Workspace$/Source/GitRepository/Migration.Data.csproj Output Path: $Workspace$\Output
Targets: build;migrate
Properties: MigratorToolPath=$Workspace$\Source<span style=“color: #000000; background: #f8f8f8;”>GitRepository</span>packages\EntityFramework.6.1.1\toolsThanks a lot.