Tim Long
Tim Long

Reputation: 13788

Targets seem to be building in the wrong order when building Wix Custom Action under TeamCity

I'm having problems getting my CI build to work under TeamCity. I've got similar projects that build OK, so I don;t think it is a TeamCity problem per se, but I've looked at this so much I'm starting to go code blind and I fear I may be missing the obvious. I would appreciate another perspective.

The project I'm working on (an ASCOM driver) has a Wix setup project and a managed custom action. The custom action has a unit test project that uses MSpec. This all builds fine on my workstation, the tests run and pass, all good. On TeamCity, the solution will not even compile. I welcome the fact that TeamCity may have highlighted a weakness in my build, but I can't understand what's going on here.

What appears to be happening is that the build is deleting one of the project outputs (the Wix custom action) during the build, which means that a subsequent project that references it fails to build. Here's some edited highlights from the log output:

The setup projects startsto build...

715 [01:21:20]:                             [MSBuild] Product Setup\Product Setup.wixproj: Build target: Rebuild (11s)
716 [01:21:20]:                                 [Product Setup\Product Setup.wixproj] CoreClean
717 [01:21:20]:                                     [CoreClean] Delete
[...]

Then it resolves references and notices that the Custom Action project needs to be built...

729 [01:21:20]:                                 [Product Setup\Product Setup.wixproj] ResolveProjectReferences (2s)
730 [01:21:21]:                                     [ResolveProjectReferences] MSBuild (2s)
731 [01:21:21]:                                         [MSBuild] Wix.RegisterAscomDeviceProfiles\Wix.RegisterAscomDeviceProfiles.csproj: Build default targets (2s)
732 [01:21:21]:                                             [Wix.RegisterAscomDeviceProfiles\Wix.RegisterAscomDeviceProfiles.csproj] CheckPrerequisites
733 [01:21:21]:                                             [Wix.RegisterAscomDeviceProfiles\Wix.RegisterAscomDeviceProfiles.csproj] RestorePackages

Then the Custom Action project builds and the CA assembly gets packaged and the output copied to the output directory...

739 [01:21:21]:                                                 [CoreCompile] Csc
740 [01:21:21]:                                                     [Csc] C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /platform:AnyCPU /errorreport:prompt /define:DEBUG;TRACE /highentropyva- /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Astrometry.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Attributes.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Controls.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.DeviceInterfaces.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.DriverAccess.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Exceptions.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.SettingsProvider.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Utilities.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\DTF-Unofficial.3.6.2928\lib\Microsoft.Deployment.WindowsInstaller.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\CompanyTools\bin\Debug\CompanyTools.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\TiGra.Diagnostics.1.1.57\lib\net35\TiGra.Diagnostics.dll /debug+ /debug:full /filealign:512 /out:obj\Debug\Wix.RegisterAscomDeviceProfiles.dll /target:library /utf8output CustomAction.cs Properties\AssemblyInfo.cs SetupTraceListener.cs
741 [01:21:21]:                                                     [Csc] CustomAction.cs(28, 23): warning CS0169: The field 'Wix.RegisterAscomDeviceProfiles.CustomActions.driverId' is never used
742 [01:21:21]:                                                     [Csc] CustomAction.cs(29, 23): warning CS0169: The field 'Wix.RegisterAscomDeviceProfiles.CustomActions.driverName' is never used
743 [01:21:21]:                                             [Wix.RegisterAscomDeviceProfiles\Wix.RegisterAscomDeviceProfiles.csproj] PackCustomAction (1s)
744 [01:21:21]:                                                 [PackCustomAction] Exec (1s)
745 [01:21:21]:                                                     [Exec] "C:\Program Files (x86)\WiX Toolset v3.7\bin\..\sdk\MakeSfxCA.exe" "C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\obj\Debug\Wix.RegisterAscomDeviceProfiles.CA.dll" "C:\Program Files (x86)\WiX Toolset v3.7\bin\..\sdk\x86\SfxCA.dll" "C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\obj\Debug\Wix.RegisterAscomDeviceProfiles.dll" "C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Astrometry.dll;C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Attributes.dll;C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Controls.dll;C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.DeviceInterfaces.dll;C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.DriverAccess.dll;C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Exceptions.dll;C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.SettingsProvider.dll;C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Utilities.dll;C:\BuildAgent\work\bf752c89b3da5535\packages\DTF-Unofficial.3.6.2928\lib\Microsoft.Deployment.WindowsInstaller.dll;C:\BuildAgent\work\bf752c89b3da5535\CompanyTools\bin\Debug\CompanyTools.dll;C:\BuildAgent\work\bf752c89b3da5535\packages\TiGra.Diagnostics.1.1.57\lib\net35\TiGra.Diagnostics.dll;C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Internal.Extensions.dll;C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\CustomAction.config"

The CA build completed and the Setup build resumes:

803 [01:21:23]:                                 [Product Setup\Product Setup.wixproj] Compile (1s)
804 [01:21:23]:                                     [Compile] Candle (1s)
805 [01:21:23]:                                         [Candle] C:\Program Files (x86)\WiX Toolset v3.7\bin\candle.exe -dDebug -d"DevEnvDir=*Undefined if not building from within Visual Studio*" -dSolutionDir=C:\BuildAgent\work\bf752c89b3da5535\ -dSolutionExt=.sln -dSolutionFileName=Product.sln -dSolutionName=Product -dSolutionPath=C:\BuildAgent\work\bf752c89b3da5535\Product.sln -dConfiguration=Debug -dOutDir=bin\Debug-x86\ -dPlatform=x86 -d"ProjectDir=C:\BuildAgent\work\bf752c89b3da5535\Product Setup\\" -dProjectExt=.wixproj -d"ProjectFileName=Product Setup.wixproj" -d"ProjectName=Product Setup" -d"ProjectPath=C:\BuildAgent\work\bf752c89b3da5535\Product Setup\Product Setup.wixproj" -d"TargetDir=C:\BuildAgent\work\bf752c89b3da5535\Product Setup\bin\Debug-x86\\" -dTargetExt=.msi -d"TargetFileName=Product Setup.msi" -d"TargetName=Product Setup" -d"TargetPath=C:\BuildAgent\work\bf752c89b3da5535\Product Setup\bin\Debug-x86\Product Setup.msi" -dDeviceType1.Configuration=Debug -d"DeviceType1.FullConfiguration=Debug|AnyCPU" -dDeviceType1.Platform=AnyCPU -dDeviceType1.ProjectDir=C:\BuildAgent\work\bf752c89b3da5535\DeviceType1\ -dDeviceType1.ProjectExt=.csproj -dDeviceType1.ProjectFileName=DeviceType1.csproj -dDeviceType1.ProjectName=DeviceType1 -dDeviceType1.ProjectPath=C:\BuildAgent\work\bf752c89b3da5535\DeviceType1\DeviceType1.csproj -dDeviceType1.TargetDir=C:\BuildAgent\work\bf752c89b3da5535\DeviceType1\bin\Debug\ -dDeviceType1.TargetExt=.dll -dDeviceType1.TargetFileName=ASCOM.Product.DeviceType.dll -dDeviceType1.TargetName=ASCOM.Product.DeviceType -dDeviceType1.TargetPath=C:\BuildAgent\work\bf752c89b3da5535\DeviceType1\bin\Debug\ASCOM.Product.DeviceType.dll -dProductCommander.Configuration=Debug -d"ProductCommander.FullConfiguration=Debug|AnyCPU" -dProductCommander.Platform=AnyCPU -d"ProductCommander.ProjectDir=C:\BuildAgent\work\bf752c89b3da5535\Product Commander\\" -dProductCommander.ProjectExt=.csproj -dProductCommander.ProjectFileName=ProductCommander.csproj -dProductCommander.ProjectName=ProductCommander -d"ProductCommander.ProjectPath=C:\BuildAgent\work\bf752c89b3da5535\Product Commander\ProductCommander.csproj" -d"ProductCommander.TargetDir=C:\BuildAgent\work\bf752c89b3da5535\Product Commander\bin\Debug\\" -dProductCommander.TargetExt=.exe -d"ProductCommander.TargetFileName=Product Commander.exe" -d"ProductCommander.TargetName=Product Commander" -d"ProductCommander.TargetPath=C:\BuildAgent\work\bf752c89b3da5535\Product Commander\bin\Debug\Product Commander.exe" -dProductServer.Configuration=Debug -d"ProductServer.FullConfiguration=Debug|AnyCPU" -dProductServer.Platform=AnyCPU -d"ProductServer.ProjectDir=C:\BuildAgent\work\bf752c89b3da5535\Product Server\\" -dProductServer.ProjectExt=.csproj -dProductServer.ProjectFileName=ProductServer.csproj -dProductServer.ProjectName=ProductServer -d"ProductServer.ProjectPath=C:\BuildAgent\work\bf752c89b3da5535\Product Server\ProductServer.csproj" -d"ProductServer.TargetDir=C:\BuildAgent\work\bf752c89b3da5535\Product Server\bin\Debug\\" -dProductServer.TargetExt=.exe -dProductServer.TargetFileName=ASCOM.Product.exe -dProductServer.TargetName=ASCOM.Product -d"ProductServer.TargetPath=C:\BuildAgent\work\bf752c89b3da5535\Product Server\bin\Debug\ASCOM.Product.exe" -dCompanyTools.Configuration=Debug -d"CompanyTools.FullConfiguration=Debug|AnyCPU" -dCompanyTools.Platform=AnyCPU -dCompanyTools.ProjectDir=C:\BuildAgent\work\bf752c89b3da5535\CompanyTools\ -dCompanyTools.ProjectExt=.csproj -dCompanyTools.ProjectFileName=CompanyTools.csproj -dCompanyTools.ProjectName=CompanyTools -dCompanyTools.ProjectPath=C:\BuildAgent\work\bf752c89b3da5535\CompanyTools\CompanyTools.csproj -dCompanyTools.TargetDir=C:\BuildAgent\work\bf752c89b3da5535\CompanyTools\bin\Debug\ -dCompanyTools.TargetExt=.dll -dCompanyTools.TargetFileName=CompanyTools.dll -dCompanyTools.TargetName=CompanyTools -dCompanyTools.TargetPath=C:\BuildAgent\work\bf752c89b3da5535\CompanyTools\bin\Debug\CompanyTools.dll -dDeviceType1.Configuration=Debug -d"DeviceType1.FullConfiguration=Debug|AnyCPU" -dDeviceType1.Platform=AnyCPU -dDeviceType1.ProjectDir=C:\BuildAgent\work\bf752c89b3da5535\DeviceType1\ -dDeviceType1.ProjectExt=.csproj -dDeviceType1.ProjectFileName=DeviceType1.csproj -dDeviceType1.ProjectName=DeviceType1 -dDeviceType1.ProjectPath=C:\BuildAgent\work\bf752c89b3da5535\DeviceType1\DeviceType1.csproj -dDeviceType1.TargetDir=C:\BuildAgent\work\bf752c89b3da5535\DeviceType1\bin\Debug\ -dDeviceType1.TargetExt=.dll -dDeviceType1.TargetFileName=ASCOM.Product.DeviceType.dll -dDeviceType1.TargetName=ASCOM.Product.DeviceType -dDeviceType1.TargetPath=C:\BuildAgent\work\bf752c89b3da5535\DeviceType1\bin\Debug\ASCOM.Product.DeviceType.dll -dWix.RegisterAscomDeviceProfiles.Configuration=Debug -d"Wix.RegisterAscomDeviceProfiles.FullConfiguration=Debug|AnyCPU" -dWix.RegisterAscomDeviceProfiles.Platform=AnyCPU -dWix.RegisterAscomDeviceProfiles.ProjectDir=C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\ -dWix.RegisterAscomDeviceProfiles.ProjectExt=.csproj -dWix.RegisterAscomDeviceProfiles.ProjectFileName=Wix.RegisterAscomDeviceProfiles.csproj -dWix.RegisterAscomDeviceProfiles.ProjectName=Wix.RegisterAscomDeviceProfiles -dWix.RegisterAscomDeviceProfiles.ProjectPath=C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\Wix.RegisterAscomDeviceProfiles.csproj -dWix.RegisterAscomDeviceProfiles.TargetDir=C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\bin\Debug\ -dWix.RegisterAscomDeviceProfiles.TargetExt=.dll -dWix.RegisterAscomDeviceProfiles.TargetFileName=Wix.RegisterAscomDeviceProfiles.dll -dWix.RegisterAscomDeviceProfiles.TargetName=Wix.RegisterAscomDeviceProfiles -dWix.RegisterAscomDeviceProfiles.TargetPath=C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\bin\Debug\Wix.RegisterAscomDeviceProfiles.dll -out obj\Debug\ -arch x86 -ext ..\Lib\Wix\WixNetFxExtension.dll -ext ..\Lib\Wix\WixUIExtension.dll AscomDeviceProfileData.wxs CommanderApp.wxs DeviceTypeDriver.wxs LocalServer.wxs Product.wxs DeviceTypeDriver.wxs
806 [01:21:24]:                                         [Candle] Windows Installer Xml Compiler version 3.7.1224.0

Now here's where it all goes awry. The Custom Action project goes on to try to rebuild and does a CoreClean action:

827 [01:21:32]:                             [MSBuild] Wix.RegisterAscomDeviceProfiles\Wix.RegisterAscomDeviceProfiles.csproj: Build target: Rebuild
828 [01:21:32]:                                 [Wix.RegisterAscomDeviceProfiles\Wix.RegisterAscomDeviceProfiles.csproj] CleanCustomAction
829 [01:21:32]:                                     [CleanCustomAction] Delete
830 [01:21:32]:                                         [Delete] Deleting file "obj\Debug\Wix.RegisterAscomDeviceProfiles.CA.dll".
831 [01:21:32]:                                 [Wix.RegisterAscomDeviceProfiles\Wix.RegisterAscomDeviceProfiles.csproj] CoreClean
832 [01:21:32]:                                     [CoreClean] Delete

Then shortly after that, the MSpec unit test project tries to build, and can't find the outputs from the Custom Action project.

907 [01:21:33]: [Wix.RegisterAscomDeviceProfiles.Specifications\Wix.RegisterAscomDeviceProfiles.Specifications.csproj] ResolveAssemblyReferences 908 [01:21:33]: [ResolveAssemblyReferences] ResolveAssemblyReference 909 [01:21:33]: [ResolveAssemblyReference] Primary reference "Wix.RegisterAscomDeviceProfiles". 910 [01:21:33]: [ResolveAssemblyReference] Could not find dependent files. Expected file "C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\bin\Debug\Wix.RegisterAscomDeviceProfiles.dll" does not exist. 911 [01:21:33]: [ResolveAssemblyReference] Could not find dependent files. Expected file "C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\bin\Debug\Wix.RegisterAscomDeviceProfiles.dll" does not exist. 912 [01:21:33]: [ResolveAssemblyReference] Resolved file path is "C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\bin\Debug\Wix.RegisterAscomDeviceProfiles.dll". 913 [01:21:33]: [ResolveAssemblyReference] Reference found at search path location "". 914 [01:21:33]: [ResolveAssemblyReference] The ImageRuntimeVersion for this reference is "". 915 [01:21:33]: [Wix.RegisterAscomDeviceProfiles.Specifications\Wix.RegisterAscomDeviceProfiles.Specifications.csproj] CoreCompile 916 [01:21:33]: [CoreCompile] Csc 917 [01:21:33]: [Csc] C:\Windows\Microsoft.NET\Framework\v4.0.30319\Csc.exe /noconfig /nowarn:1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:DEBUG;TRACE /highentropyva- /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Astrometry.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Attributes.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Controls.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.DeviceInterfaces.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.DriverAccess.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Exceptions.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.SettingsProvider.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\ASCOM.Platform.6.0.2.1\lib\net35\ASCOM.Utilities.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\FakeItEasy.1.13.1\lib\net35\FakeItEasy.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\packages\Machine.Specifications.0.5.14\lib\net20\Machine.Specifications.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll /reference:C:\BuildAgent\work\bf752c89b3da5535\CompanyTools\bin\Debug\CompanyTools.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /reference:C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\bin\Debug\Wix.RegisterAscomDeviceProfiles.dll /debug+ /debug:full /filealign:512 /optimize- /out:obj\Debug\Wix.RegisterAscomDeviceProfiles.Specifications.dll /target:library /utf8output Properties\AssemblyInfo.cs RegisterAscomDeviceProfilesSpecs.cs 918 [01:21:33]: [Csc] CSC error CS0006: Metadata file 'C:\BuildAgent\work\bf752c89b3da5535\Wix.RegisterAscomDeviceProfiles\bin\Debug\Wix.RegisterAscomDeviceProfiles.dll' could not be found 919 [01:21:33]: [Wix.RegisterAscomDeviceProfiles.Specifications\Wix.RegisterAscomDeviceProfiles.Specifications.csproj] Project Wix.RegisterAscomDeviceProfiles.Specifications\Wix.RegisterAscomDeviceProfiles.Specifications.csproj failed.

I can't figure out why things appear to be happening all out of order on the build server. This all builds happily within Visual Studio on my workstation. Any thoughts?

Upvotes: 8

Views: 1486

Answers (1)

Demarily
Demarily

Reputation: 63

Set teamcity.msbuild.generateWrappingScript to false

Can be found here: MSBuild - Implementation notes

Implementation notes

MSBuild runner generates an MSBuild script that includes user's script. This script is used to add TeamCity provided msbuild tasks. Your MSBuild script will be included with the <Import> task. If you specified a Visual Studio solution file, it will be called from the <MSBuild> task. To disable it, set teamcity.msbuild.generateWrappingScript to false.

Upvotes: 0

Related Questions