Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TeamCity Build Failure

I have tried many things today to get my build to work in Teamcity but to no avail.

Here is my setup.

I have 2 build configurations in TeamCity

  1. Build Solution
  2. Build Deployment Package Debug

Build Solution is triggered by an SVN checkin and builds the solution file. This configuration works fine.

Build Deployment Package Debug has Build Solution as its dependency and has two (MSBuild) build steps. The solution contains two websites: a front end one and an admin one. One build step builds the front end site and the other the admin site. The end result is that it puts the combined results into a zip file for deployment to the deployment server (I've not got to this bit yet).

The problem that I have is that the Build Deployment Package Debug configuration fails trying to build the first site. This is the error:

[18:40:25]Step 1/2: Web (MSBuild) (29s)
[18:40:28][Step 1/2] x.Web\x.Web.csproj.teamcity: Build target: Build (27s)
[18:40:50][x.Web\x.Web.csproj.teamcity] MvcBuildViews (4s)
[18:40:50][MvcBuildViews] AspNetCompiler (4s)
[18:40:55][AspNetCompiler] C:\BuildAgent\work\252ec59002ecc2d\x.Web\obj\debug\csautoparameterize\original\web.config(39, 0): error ASPCONFIG: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level.  This error can be caused by a virtual directory not being configured as an application in IIS.
[18:40:55][x.Web\x.Web.csproj.teamcity] Project x.Web\x.Web.csproj.teamcity failed.
[18:40:55][Step 1/2] Step Web (MSBuild) failed

Here are Build Paramters -> System Properties

Name    Value
system._PackageTempDir   c:\deploypackage
system.Configuration     Debug
system.CreatePackageOnPublish    True
system.DeployIisAppPath  Debug
system.DeployOnBuild     True
system.PackageLocation   c:\buildshares\Debug\Debug.zip
like image 898
Sachin Kainth Avatar asked Apr 25 '13 17:04

Sachin Kainth


1 Answers

Here's what I did to solve this

I already had this in my project file

<Target Name="MvcBuildViews" AfterTargets="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
    <AspNetCompiler VirtualPath="temp" PhysicalPath="$(WebProjectOutputDir)" />
</Target>

But I needed to add this also

<Target Name="AfterBuild">
    <RemoveDir Directories="$(BaseIntermediateOutputPath)" />
</Target>

Doing this fixed the issue.

I hope this helps someone else who is working on TeamCity in the future.

like image 59
Sachin Kainth Avatar answered Nov 03 '22 09:11

Sachin Kainth