TeamCity Build Failure

南笙酒味 提交于 2019-11-27 21:26:53

问题


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

回答1:


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.



来源:https://stackoverflow.com/questions/16221503/teamcity-build-failure

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!