I am trying to setup the existing Community Library template: “Run Entity Framework migrations (Update-Database)” to execute the EF migration.exe tool during the deployment.
I had no problems with the setup, however the migration tool fails with an error because it can not find a file needed during the execution of the Seed() method. Basically the assembly with the EF migrations is in the /bin
folder and a config json file path fails to resolve, because the current executing directory is not the /bin
folder.
I have the current directory structure:
/bin
- the assembly location
/App_Data
- the Seed method json config location
When the migration tool is executed by the step template I get this error:
ERROR: Could not find a part of the path 'C:\Windows\system32\config\systemprofile\AppData\Local\assembly\dl3\4LPBW244.CR4\DZO34RQG.YAW\caa6207b\App_Data\data.seed.configuration.any.json'
I would expect the current execution directory to be the \bin
folder, why: C:\Windows\system32\config\systemprofile\AppData\Local\assembly\dl3\4LPBW244.CR4\DZO34RQG.YAW\caa6207b
???
The EF assembly contains custom code that is relient on loading that json config for the Seed() method and I am not sure if I can set the current dorectory to \bin
???
I already tried modifying the step powershell script body by adding the following line:
Set-Location $binPath -Verbose
Write-Host "Current Directory: '$((Get-Location).Path)'"
prior to setting the $migrateCommand
variable and the invokation of the migrate tool but this seem not to have any effect…
I also tried running just the migrate command (copied it from the log):
& "I:\wwwroot\fosite\viser\byway\bin\migrate.exe" "FO.BAR.WebAPI.Byway.dll" /connectionStringName="FEDB" /startupConfigurationFile="I:\wwwroot\fosite\viser\byway\Octopus.Db.Migrations.config" /startUpDirectory="I:\wwwroot\fosite\viser\byway\bin" /Verbose
using the Octopus Script Management Console
and I am getting identical output as the error above again refering to a folder under the temp user directory:
ERROR: Could not find a part of the path 'C:\Windows\system32\config\systemprofile\AppData\Local\assembly\dl3\4LPBW244.CR4\DZO34RQG.YAW\caa6207b\App_Data\data.seed.configuration.any.json'
How can I set the exucuting directory to be the \bin
folder?
Please also review the attached raw output log of the step execution:
Octopus.DbMigrations.Step.log (8.7 KB)
Many Thanks,
Emil