由于EF代码迁移,Teamcity构建失败

时间:2015-05-29 11:51:19

标签: entity-framework-4 teamcity ef-migrations teamcity-8.0

我的TeamCity构建失败,因为我有一个项目,其中包含2个EF代码迁移配置。

来自构建日志:

[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

注意:唯一的红色(失败)是上面的最后两行" Build Finished"

我没有运行迁移,但我无法在团队城市或发布配置文件中看到尝试执行此操作的任何步骤。

我不想将配置拆分为单独的项目,我只想阻止TeamCity尝试运行它们。

我的构建步骤是:

1/8 Gulp - 最小化js文件

2/8 NuGet Installer - 更新解决方案中的nuget引用

3/8 MSBuild - .NET 4.5 x86编译

4/8 NUnit - 运行单元测试

5/8 Powershell - 运行脚本来操作windows服务的app.config文件

6/8 MSBuild - 使用发布配置文件部署网站

7/8 Powershell - 部署数据库的脚本

8/8 Powershell - 部署Windows服务的脚本

发布配置文件:验证连接按钮在连接选项卡上正常工作,在设置页面上列出了几个数据库但没有连接字符串或"在运行时使用此连接字符串"检查。其中一个旁边有一个信息标签"为了发布Code First模型,应该使用Code First Migrations"。

我们为其他可以正常工作的项目提供了几乎相同的构建配置。

由于

1 个答案:

答案 0 :(得分:2)

从日志中可以看出,您似乎尝试在步骤7 - 部署数据库步骤中应用EF迁移。

Highlight

这是抛出配置异常的地方。

如果目标是阻止TeamCity运行它们,那么禁用该步骤就可以了。

希望这有帮助