TeamCity 构建失败 [英] TeamCity Build Failure
问题描述
我今天尝试了很多方法来让我的构建在 Teamcity 中工作,但无济于事.
I have tried many things today to get my build to work in Teamcity but to no avail.
这是我的设置.
我在 TeamCity 中有 2 个构建配置
I have 2 build configurations in TeamCity
构建解决方案
构建部署包调试
Build Solution
由 SVN 签入触发并构建解决方案文件.此配置运行良好.
Build Solution
is triggered by an SVN checkin and builds the solution file. This configuration works fine.
Build Deployment Package Debug
具有 Build Solution
作为其依赖项,并且有两个 (MSBuild) 构建步骤.该解决方案包含两个网站:一个前端网站和一个管理员网站.一个构建步骤构建前端站点,另一个构建管理站点.最终结果是将合并后的结果放入一个 zip 文件中,以便部署到部署服务器(我还没有涉及到这一点).
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).
我遇到的问题是 Build Deployment Package Debug
配置在尝试构建第一个站点时失败.这是错误:
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
推荐答案
这是我为解决这个问题所做的
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>
但我还需要添加这个
<Target Name="AfterBuild">
<RemoveDir Directories="$(BaseIntermediateOutputPath)" />
</Target>
这样做解决了这个问题.
Doing this fixed the issue.
我希望这对将来在 TeamCity 工作的其他人有所帮助.
I hope this helps someone else who is working on TeamCity in the future.
这篇关于TeamCity 构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!