My TeamCity build fails because I have a project that has 2 EF Code Migration configurations in it.
From the build log:
[12:39:58]Checking for changes
[12:39:58]Collecting changes in 1 VCS root (1s)
[12:40:00]Clearing temporary directory: C:\TeamCity\buildAgent2\temp\buildTmp
[12:40:00]Publishing internal artifacts
[12:40:00]Checkout directory: C:\TeamCity\buildAgent2\work\1679b8b30e00ad0
[12:40:00]Updating sources: server side checkout (2s)
[12:40:03]Step 1/8: Gulp (Command Line)
[12:40:03]Step 2/8: Nuget Package Refresh (NuGet Installer) (3s)
[12:40:06]Step 3/8: Compile (MSBuild) (21s)
[12:40:27]Step 4/8: Unit Tests (NUnit) (33s)
[12:41:01]Step 5/8: Transform Files (Powershell) (2s)
[12:41:03]Step 6/8: Deployment Build on XXXXX Live (MSBuild) (25s)
[12:41:29]Step 7/8: Deploy Database (Powershell) (5s)
[12:41:34]Step 8/8: Deploy Portal.Hub (Powershell) (33s)
[12:42:08]Publishing artifacts
[12:42:08][Publishing artifacts] Collecting files to publish: [C:\TeamCity\buildAgent2\temp\buildTmp\nuget5954880593924726328packages\nuget.xml => .teamcity/nuget]
[12:42:08][Publishing artifacts] Publishing using [WebPublisher]
[12:42:08][Publishing artifacts] Publishing using [ArtifactsCachePublisher]
[12:42:08][Publishing artifacts] Artifacts path 'C:/TeamCity/buildAgent2/temp/buildTmp/nuget5954880593924726328packages/nuget.xml' not found
[12:42:08]Reverting patched assembly versions
[12:42:08][Reverting patched assembly versions] Restoring C:\TeamCity\buildAgent2\work\1679b8b30e00ad0\src\Portal.Api\Properties\AssemblyInfo.cs
[12:42:08][Reverting patched assembly versions] Restoring C:\TeamCity\buildAgent2\work\1679b8b30e00ad0\src\Portal.Common\Properties\AssemblyInfo.cs
[12:42:08][Reverting patched assembly versions] Restoring C:\TeamCity\buildAgent2\work\1679b8b30e00ad0\src\Portal.Data\Properties\AssemblyInfo.cs
[12:42:08][Reverting patched assembly versions] Restoring C:\TeamCity\buildAgent2\work\1679b8b30e00ad0\src\Portal.Hub\Properties\AssemblyInfo.cs
[12:42:08][Reverting patched assembly versions] Restoring C:\TeamCity\buildAgent2\work\1679b8b30e00ad0\src\Portal.Manager\Properties\AssemblyInfo.cs
[12:42:08][Reverting patched assembly versions] Restoring C:\TeamCity\buildAgent2\work\1679b8b30e00ad0\src\Portal.Managers\Properties\AssemblyInfo.cs
[12:42:08][Reverting patched assembly versions] Restoring C:\TeamCity\buildAgent2\work\1679b8b30e00ad0\src\Portal.SignalR\Properties\AssemblyInfo.cs
[12:42:08][Reverting patched assembly versions] Restoring C:\TeamCity\buildAgent2\work\1679b8b30e00ad0\src\Portal.Tests\Properties\AssemblyInfo.cs
[12:42:08]Publishing internal artifacts
[12:42:08][Publishing internal artifacts] Sending using WebPublisher
[12:42:08][Publishing internal artifacts] Sending using ArtifactsCachePublisher
[12:42:08]Build failure condition: There was an error reported in one of the build steps.
[12:42:08]Build failure condition cause message: ERROR: More than one migrations configuration type was found in the assembly 'Portal.Data'. Specify the name of the one to use. (show original message)
[12:42:08]Build finished
Note: the only red (failures) are the last two lines above "Build Finished"
I am not running the migrations and I can't see any steps in team city or the publish profile that would be attempting to do this.
I do not want to split my configurations into separate projects, I just want to stop TeamCity from attempting to run them.
My Build Steps are:
1/8 Gulp - minimize js files
2/8 NuGet Installer - update nuget references in the solution
3/8 MSBuild - .NET 4.5 x86 compile
4/8 NUnit - run unit tests
5/8 Powershell - run script to manipulate app.config files for the windows service
6/8 MSBuild - use publish profile to deploy website
7/8 Powershell - script to deploy database
8/8 Powershell - script to deploy windows service
The publish profile: validation connection button works OK on the connection tab, on the settings page there are several databases listed but none have connection strings or "use this connection string at runtime" checked. One of them has an info label next to it "In order to publish a Code First Model, Code First Migrations should be used".
We have virtually identical build configurations for other projects which work fine.
Thanks
From the logs, it does appear as though you are trying to apply the EF migrations in Step 7 - Deploy Database Step.
This is where the config exception is getting thrown.
If the goal is to stop TeamCity from running them then disabling the step would do that.
Hope this helps
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