TeamCity构建失败

Sac*_*nth 5 msbuild teamcity

我今天尝试了很多东西来让我的构建在Teamcity中工作,但无济于事.

这是我的设置.

我在TeamCity中有2个构建配置

  1. Build Solution
  2. Build Deployment Package Debug

Build Solution由SVN签入触发并构建解决方案文件.这种配置工作正常.

Build Deployment Package Debug具有Build Solution依赖性并具有两个(MSBuild)构建步骤.该解决方案包含两个网站:前端网站和管理网站.一个构建步骤构建前端站点,另一个构建管理站点.最终的结果是它将组合结果放入一个zip文件中,以便部署到部署服务器(我还没有完成这一点).

我遇到的问题是Build Deployment Package Debug配置无法尝试构建第一个站点.这是错误:

[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
Run Code Online (Sandbox Code Playgroud)

这是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
Run Code Online (Sandbox Code Playgroud)

Sac*_*nth 20

这就是我为解决这个问题所做的工作

我已经在我的项目文件中有这个了

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

但我还需要补充一下

<Target Name="AfterBuild">
    <RemoveDir Directories="$(BaseIntermediateOutputPath)" />
</Target>
Run Code Online (Sandbox Code Playgroud)

这样做解决了这个问题.

我希望这可以帮助将来在TeamCity工作的其他人.

  • 谢谢你回来回答这个问题.正在撕裂我的头发 (2认同)