Skip to content

EF Core 2 Migrations in VSTS CD Release #9841

Closed as not planned
Closed as not planned

Description

Attempting to execute the following batch script that runs an EF Core 2 migration against published code in a VSTS continuous delivery release (adapted from Ben Day's article located here: https://www.benday.com/2017/03/17/deploy-entity-framework-core-migrations-from-a-dll/).

`set EfMigrationsNamespace=%1
set EfMigrationsDllName=%2.dll
set EfMigrationsDllDepsJson=%2.deps.json
set DllDir=%cd%
set PathToNuGetPackages=%USERPROFILE%.nuget\packages
set NuGetFallbackFolder="C:\Program Files\dotnet\sdk\NuGetFallbackFolder"
set PathToEfDll="C:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.entityframeworkcore.tools.dotnet\2.0.0\tools\netcoreapp2.0\ef.dll"

dotnet exec --depsfile .%EfMigrationsDllDepsJson% --additionalprobingpath %PathToNuGetPackages% --additionalprobingpath %NuGetFallbackFolder% %PathToEfDll% database update --assembly .%EfMigrationsDllName% --startup-assembly .%EfMigrationsDllName% --project-dir . --data-dir %DllDir% --verbose --root-namespace %EfMigrationsNamespace%`

This works locally, but fails in the hosted agent because it cannot find the location of %PathtoEfDll%. Where can I reliably locate the ef.dll on the hosted vs2017 build agent?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions