I am working on Azure DevOps CI CD Pipelines. The project's Backend is Dotnet Core, Frontend is Angular 8 and for Database, we used Entity Framework code-first approach. I was able to add Front and back end in pipelines. Now I am stuck with database deployment. since I was also unable to find any dedicated article.
The project is consists of Multi Context and Multi-Project. Reference folder structure
At local we usually run this command to generate migration and it works fine.
Add-Migration -Context ABCCompanyContext AddCompanyTable
Now, in Pipeline i have added the following command which I get from stackoverflow it self. but it didn't work. But from the error. it seems like I am really close
Pipeline Command
dotnet tool install --global dotnet-ef dotnet ef migrations script -i -o $(Build.ArtifactStagingDirectory)\Migrations\migrate.sql --project **/ABC.Company.Data.csproj --startup-project **/ABC.Company.Api.csproj -i -o $(Build.ArtifactStagingDirectory)\Migrations\migrate.sql
Error Log
2020-12-24T06:49:27.0265041Z ========================== Starting Command Output =========================== 2020-12-24T06:49:27.0688206Z ##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a_temp\f3a33029-4f61-404f-9b64-c73c5296123a.cmd"" 2020-12-24T06:49:32.9358440Z You can invoke the tool using the following command: dotnet-ef 2020-12-24T06:49:32.9359182Z Tool 'dotnet-ef' (version '5.0.1') was successfully installed. 2020-12-24T06:49:38.4701578Z System.IO.IOException: The filename, directory name, or volume label syntax is incorrect. : 'D:\a\1\s*\obj' 2020-12-24T06:49:38.4702878Z at System.IO.FileSystem.CreateDirectory(String fullPath, Byte[] securityDescriptor) 2020-12-24T06:49:38.4703503Z at System.IO.Directory.CreateDirectory(String path) 2020-12-24T06:49:38.4704199Z at Microsoft.EntityFrameworkCore.Tools.Project.FromFile(String file, String buildExtensionsDir, String framework, String configuration, String runtime) 2020-12-24T06:49:38.4705029Z at Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute(String[] _) 2020-12-24T06:49:38.4705729Z at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.b__0(String[] args) 2020-12-24T06:49:38.4706399Z at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args) 2020-12-24T06:49:38.4707003Z at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args) 2020-12-24T06:49:38.4707626Z The filename, directory name, or volume label syntax is incorrect. : 'D:\a\1\s*\obj' 2020-12-24T06:49:38.6646502Z ##[error]Cmd.exe exited with code '1'. 2020-12-24T06:49:38.7627325Z ##[section]Finishing: Build EfCore Migrations