Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
646 views
in Technique[技术] by (71.8m points)

msbuild - 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.Webx.Web.csproj.teamcity: Build target: Build (27s)
[18:40:50][x.Webx.Web.csproj.teamcity] MvcBuildViews (4s)
[18:40:50][MvcBuildViews] AspNetCompiler (4s)
[18:40:55][AspNetCompiler] C:BuildAgentwork252ec59002ecc2dx.Webobjdebugcsautoparameterizeoriginalweb.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.Webx.Web.csproj.teamcity] Project x.Webx.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:uildsharesDebugDebug.zip
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...