I am writing a .NET Core and Entity Framework Core Application using Code-First Migrations.
I want to be able to deploy it to an Azure Web App using Visual Studio Team Services Build and Release Definitions
I want to be able to run the Database Migration as part of the Release Definition using the script
dotnet ef database update
I've done this via a Command Prompt action in the Release Definition
However I always get the message
No executable found matching command "dotnet-ef"
I've tried making sure that this command is running in the same directory as a .cproj file
I've also tried running a
dotnet restore
as a previous command prompt task, and this gives an error
The folder 'C:\a\r1\a\Drop\s\src\xxxxx' does not contain a project to restore even though it does.
Has anybody tried to do a Code First Migration as part of a Team Services Release Definition step?
My other option was to run the migration as part of the Web Application itself but I wanted to run it via the Release process rather than run it in the Application.
You need to use Hosted VS2017 agent instead of Hosted agent. My steps:
Code:
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>
dotnet
; Arguments: --version
)dotnet
; Arguments: restore
)dotnet
; Arguments: ef --version
)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With