Base solution for your next web application

Activities of "mayankm"

We've upgraded to latest version and then while merging the code, it got conflicts in DbContextModelSnapshot file.

When I run Update-Database, it says all up to date.

When I add migration to make further changes in DB, it throws below error and shows all previous migration changes in migration file along with DbContextModelSnapshot file.

What's the process to fix this migration issue?

I've downloaded latest project 12.2.1 and trying to upgrade existing project to latest one but it shows 12.2.0 in download project and also getting build error as shown in below screenshot.

Update: I'd to build this project at different location than existing repo and then copy build file into aspnetzero branch to make it built successully. However, it's good practice to fix these basic warnings to make clean CI/CD pipleline without warnings. :)

Hi @sedulen, @ismcagdas thanks. I managed to run using separate job for migration. Thank you!

Thanks Brain for your valuable details but it seems similar error when I don't choose startup project as not sure if it is becuase I'm using Angular + .net core merged project.

I'm using .Net core + Angular Merge solution.

I'm trying to create database migration script using this method: https://docs.aspnetzero.com/en/aspnet-core-mvc/latest/Setting-Up-an-Azure-Pipeline-Mvc-Core#generate-migration-scripts-task

I've following setting for the task:

but getting error as below.

Raw log:

Starting: Generate Migration Scripts ============================================================================== Task : Entity Framework Core Migrations Script Generator Description : Tool for projects that use Entity Framework Core Code-First. Generates migration scripts which can be used to update a database (for instance with the task 'Azure SQL Database Deployment'). Version : 1.0.2 Author : PEK's Productions Help : More Information ============================================================================== Project path: D:\a\1\s\src\Synegrate.PatriotWorld.EntityFrameworkCore\Synegrate.PatriotWorld.EntityFrameworkCore.csproj Start-up project path: D:\a\1\s\src\Synegrate.PatriotWorld.Web.Host\Synegrate.PatriotWorld.Web.Host.csproj Target folder: D:\a\1\a/migrations Number of database contexts: 1 All migrations will be used. Will not try to install dotnet-ef. If you are using .NET Core 3 you could enable 'Install dependencies for .NET Core 3' to do this automatically. If you are using .NET Core 2 you may need to add the 'Use .NET Core' before running this task. See here for more details: https://github.com/pekspro/EF-Migrations-Script-Generator-Task Generating migration script for PatriotWorldDbContext in project D:\a\1\s\src\Synegrate.PatriotWorld.EntityFrameworkCore\Synegrate.PatriotWorld.EntityFrameworkCore.csproj Projects will not be built before scripts are generated. Default build configuration will be used. The script will be idempotent. "C:\Program Files\dotnet\dotnet.exe" ef migrations script --project D:\a\1\s\src\Synegrate.PatriotWorld.EntityFrameworkCore\Synegrate.PatriotWorld.EntityFrameworkCore.csproj --startup-project D:\a\1\s\src\Synegrate.PatriotWorld.Web.Host\Synegrate.PatriotWorld.Web.Host.csproj --output D:\a\1\a/migrations/PatriotWorldDbContext.sql --context PatriotWorldDbContext --verbose --no-build --idempotent Using project 'D:\a\1\s\src\Synegrate.PatriotWorld.EntityFrameworkCore\Synegrate.PatriotWorld.EntityFrameworkCore.csproj'. Using startup project 'D:\a\1\s\src\Synegrate.PatriotWorld.Web.Host\Synegrate.PatriotWorld.Web.Host.csproj'. Writing 'D:\a\1\s\src\Synegrate.PatriotWorld.EntityFrameworkCore\obj\Synegrate.PatriotWorld.EntityFrameworkCore.csproj.EntityFrameworkCore.targets'... dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\VssAdministrator\AppData\Local\Temp\tmp7096.tmp /verbosity:quiet /nologo D:\a\1\s\src\Synegrate.PatriotWorld.EntityFrameworkCore\Synegrate.PatriotWorld.EntityFrameworkCore.csproj Writing 'D:\a\1\s\src\Synegrate.PatriotWorld.Web.Host\obj\Synegrate.PatriotWorld.Web.Host.csproj.EntityFrameworkCore.targets'... dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\VssAdministrator\AppData\Local\Temp\tmp7431.tmp /verbosity:quiet /nologo D:\a\1\s\src\Synegrate.PatriotWorld.Web.Host\Synegrate.PatriotWorld.Web.Host.csproj dotnet exec --depsfile D:\a\1\s\src\Synegrate.PatriotWorld.Web.Host\bin\Debug\net6.0\Synegrate.PatriotWorld.Web.Host.deps.json --additionalprobingpath C:\Users\VssAdministrator.nuget\packages --additionalprobingpath "C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages" C:\Users\VssAdministrator.nuget\packages\dotnet-ef\7.0.8\tools\net6.0\any\tools\netcoreapp2.0\any\ef.dll migrations script --output D:\a\1\a/migrations/PatriotWorldDbContext.sql --context PatriotWorldDbContext --idempotent --assembly D:\a\1\s\src\Synegrate.PatriotWorld.Web.Host\bin\Debug\net6.0\Synegrate.PatriotWorld.EntityFrameworkCore.dll --project D:\a\1\s\src\Synegrate.PatriotWorld.EntityFrameworkCore\Synegrate.PatriotWorld.EntityFrameworkCore.csproj --startup-assembly D:\a\1\s\src\Synegrate.PatriotWorld.Web.Host\bin\Debug\net6.0\Synegrate.PatriotWorld.Web.Host.dll --startup-project D:\a\1\s\src\Synegrate.PatriotWorld.Web.Host\Synegrate.PatriotWorld.Web.Host.csproj --project-dir D:\a\1\s\src\Synegrate.PatriotWorld.EntityFrameworkCore\ --root-namespace Synegrate.PatriotWorld --language C# --framework net6.0 --working-dir D:\a\1\s --verbose The specified deps.json [D:\a\1\s\src\Synegrate.PatriotWorld.Web.Host\bin\Debug\net6.0\Synegrate.PatriotWorld.Web.Host.deps.json] does not exist ##[error]The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 2147516545 Finishing: Generate Migration Scripts

Showing 1 to 5 of 5 entries