You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2025-01-16T12:37:10.1736768Z ========================== Starting Command Output ===========================
2025-01-16T12:37:10.2116103Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\ac36f023-2e25-4f6a-aeb7-4b22caa2b034.ps1'"
2025-01-16T12:37:26.7789750Z Unable to create a 'DbContext' of type 'Namespace.Infrastructure.Database.DbContext.EsDbContext'. The exception 'Could not load file or assembly 'Microsoft.Extensions.Configuration.FileExtensions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
2025-01-16T12:37:27.0535509Z ##[error]PowerShell exited with code '1'.
The only change we have made since the task started failing was updating ef tools from 9.0.0 to 9.0.1 and reflecting this in the ModelSnapshot with HasAnnotation("ProductVersion", "9.0.1").
The NuGet-packages was updated from 9.0.0 to 9.0.1 in the previous commit, but the tools were forgotten and had to be pushed separately. The first release with only NuGet updates did not have any problems when running efbundle, but the second release with the updated tools started failing.
Your code
The only difference between the failing execution and the previous one is a change to dotnet-tools.json and the model snapshot:
Microsoft.AspNetCore.SpaServices.Extensions
We also updated Microsoft.Data.SqlClient from 5.2.1 to 5.2.2.
After the update the release pipeline worked fine and the migrations were run. When we realized we had forgotten updating the tools version together with the NuGet-packages we updated them, and then the migrations started failing.
Stack traces
2025-01-16T12:30:46.4709507Z ##[section]Starting: Migrate UAT staging database
2025-01-16T12:30:46.4716052Z ==============================================================================
2025-01-16T12:30:46.4716187Z Task : PowerShell
2025-01-16T12:30:46.4716273Z Description : Run a PowerShell script on Linux, macOS, or Windows
2025-01-16T12:30:46.4716378Z Version : 2.247.1
2025-01-16T12:30:46.4716445Z Author : Microsoft Corporation
2025-01-16T12:30:46.4716556Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2025-01-16T12:30:46.4716664Z ==============================================================================
2025-01-16T12:30:48.1610679Z Generating script.
2025-01-16T12:30:48.3280709Z ========================== Starting Command Output ===========================
2025-01-16T12:30:48.4341419Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\6e8be368-8aab-47fd-af9c-a93915c08cc0.ps1'"
2025-01-16T12:30:59.1537731Z Unable to create a 'DbContext' of type 'Namespace.Infrastructure.Database.DbContext.EsDbContext'. The exception 'Could not load file or assembly 'Microsoft.Extensions.Configuration.FileExtensions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
2025-01-16T12:30:59.3481557Z ##[error]PowerShell exited with code '1'.
2025-01-16T12:30:59.3873099Z ##[section]Finishing: Migrate UAT staging database
Verbose output
2025-01-16T14:30:11.8626832Z ##[section]Starting: Migrate UAT staging database
2025-01-16T14:30:11.8635458Z ==============================================================================
2025-01-16T14:30:11.8635635Z Task : PowerShell
2025-01-16T14:30:11.8635733Z Description : Run a PowerShell script on Linux, macOS, or Windows
2025-01-16T14:30:11.8635860Z Version : 2.247.1
2025-01-16T14:30:11.8635941Z Author : Microsoft Corporation
2025-01-16T14:30:11.8636067Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
2025-01-16T14:30:11.8636195Z ==============================================================================
2025-01-16T14:30:13.5534011Z Generating script.
2025-01-16T14:30:13.6815451Z ========================== Starting Command Output ===========================
2025-01-16T14:30:13.8155027Z ##[command]"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Unrestricted -Command ". 'D:\a\_temp\81d119c8-7091-4a14-8091-a0ae3a62e123.ps1'"
2025-01-16T14:30:32.7171552Z Finding DbContext classes...
2025-01-16T14:30:32.7179146Z Using environment 'Development'.
2025-01-16T14:30:32.7187213Z Finding IDesignTimeDbContextFactory implementations...
2025-01-16T14:30:35.8268690Z Found IDesignTimeDbContextFactory implementation 'EsDbContextFactory'.
2025-01-16T14:30:35.8513525Z Found DbContext 'EsDbContext'.
2025-01-16T14:30:35.8523711Z Finding DbContext classes in the project...
2025-01-16T14:30:36.6517547Z Using DbContext factory 'EsDbContextFactory'.
2025-01-16T14:30:40.2833453Z Microsoft.EntityFrameworkCore.Design.OperationException: Unable to create a 'DbContext' of type 'Namespace.Infrastructure.Database.DbContext.EsDbContext'. The exception 'Could not load file or assembly 'Microsoft.Extensions.Configuration.FileExtensions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
2025-01-16T14:30:40.2835912Z ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.Extensions.Configuration.FileExtensions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
2025-01-16T14:30:40.2837479Z File name: 'Microsoft.Extensions.Configuration.FileExtensions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
2025-01-16T14:30:40.2838230Z at Namespace.Infrastructure.Database.DbContext.EsDbContextFactory.CreateDbContext(String[] args)
2025-01-16T14:30:40.2838874Z at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
2025-01-16T14:30:40.2839553Z at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
2025-01-16T14:30:40.2840127Z --- End of inner exception stack trace ---
2025-01-16T14:30:40.2840715Z at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType, KeyValuePair`2 contextPair)
2025-01-16T14:30:40.2841694Z at Microsoft.EntityFrameworkCore.Design.Internal.DbContextOperations.CreateContext(String contextType)
2025-01-16T14:30:40.2843173Z at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType)
2025-01-16T14:30:40.2846740Z at Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsBundle.ExecuteInternal(String[] args)
2025-01-16T14:30:40.2847447Z at Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsBundle.<>c__DisplayClass6_0.<Configure>b__0(String[] args)
2025-01-16T14:30:40.2848295Z at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
2025-01-16T14:30:40.2854266Z at Microsoft.EntityFrameworkCore.Migrations.Design.MigrationsBundle.Execute(String context, Assembly assembly, Assembly startupAssembly, String[] args)
2025-01-16T14:30:40.2858584Z Unable to create a 'DbContext' of type 'Namespace.Infrastructure.Database.DbContext.EsDbContext'. The exception 'Could not load file or assembly 'Microsoft.Extensions.Configuration.FileExtensions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
2025-01-16T14:30:40.5511403Z ##[error]PowerShell exited with code '1'.
2025-01-16T14:30:40.6023072Z ##[section]Finishing: Migrate UAT staging database
EF Core version
9.0.1
Database provider
Microsoft.EntityFrameworkCore.SqlServer
Target framework
.NET9.0
Operating system
Azure Agent: windows-latest
The text was updated successfully, but these errors were encountered:
By default, the package installs with PrivateAssets="All" and IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive", but adding <Publish>true</Publish> to the package reference worked 👍
Bug description
We run
efbundle
as part of our Azure Pipeline:This crashes with the following error:
The only change we have made since the task started failing was updating ef tools from
9.0.0
to9.0.1
and reflecting this in theModelSnapshot
withHasAnnotation("ProductVersion", "9.0.1")
.The NuGet-packages was updated from
9.0.0
to9.0.1
in the previous commit, but the tools were forgotten and had to be pushed separately. The first release with only NuGet updates did not have any problems when runningefbundle
, but the second release with the updated tools started failing.Your code
The only difference between the failing execution and the previous one is a change to
dotnet-tools.json
and the model snapshot:OLD dotnet-tools.json that worked:
NEW dotnet-tools.json in version with error:
OLD snapshot that worked:
NEW snapshot in version with error:
The code we run in the pipeline is this PowerShell Task:
In the commit before the migration started failing we updated the following NuGet-packages from 9.0.0 to 9.0.1:
We also updated Microsoft.Data.SqlClient from 5.2.1 to 5.2.2.
After the update the release pipeline worked fine and the migrations were run. When we realized we had forgotten updating the tools version together with the NuGet-packages we updated them, and then the migrations started failing.
Stack traces
Verbose output
EF Core version
9.0.1
Database provider
Microsoft.EntityFrameworkCore.SqlServer
Target framework
.NET9.0
Operating system
Azure Agent: windows-latest
The text was updated successfully, but these errors were encountered: