排除teamcity工件中的文件类型

时间:2010-10-08 11:22:18

标签: teamcity teamcity-5.1

我正准备第一次独立设置团队城市。我不得不说,在很多方面非常好看和简单。但是,我有一个问题,我无法解决并找到任何相关信息。

当我想发布我的工件时,我想排除一些文件类型。

示例:

%system.agent.work.dir%\trunk\Source\Projects\Webproject.Web/Controllers => Webproject.Web/Controllers

但是,我不想复制文件夹中的所有.cs文件。我只需要文件夹。 是否可以只复制文件夹而不是内容,然后复制我需要的内容?或者,如果我复制目录,我可以排除文件吗?

1 个答案:

答案 0 :(得分:3)

您可以添加一个MSBUILD目标,为您准备“部署”程序包。我有以下内容(可能需要对您的项目进行一些更改):

  <Target Name="Publish" DependsOnTargets="Build" Condition="'$(WebProjectOutputDir)'!=''">
    <RemoveDir Directories="$(WebProjectOutputDir)" ContinueOnError="true" />
    <!-- Log tasks -->
    <Message Text="Publishing web application for $(MSBuildProjectName)" />
    <Message Text="WebProjectOutputDir: $(WebProjectOutputDir)" />
    <!-- Create the _PublishedWebsites\app\bin folder -->
    <MakeDir Directories="$(WebProjectOutputDir)\bin" />
    <!-- Copy build outputs to _PublishedWebsites\app\bin folder -->
    <Copy SourceFiles="@(IntermediateAssembly)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" />
    <Copy SourceFiles="@(AddModules)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" />
    <Copy SourceFiles="$(IntermediateOutputPath)$(_SGenDllName)" DestinationFolder="$(WebProjectOutputDir)\%(Content.SubFolder)%(Content.RecursiveDir)" SkipUnchangedFiles="true" Condition="'$(_SGenDllCreated)'=='true'" />
    <Copy SourceFiles="$(IntermediateOutputPath)$(TargetName).pdb" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" Condition="'$(_DebugSymbolsProduced)'=='true'" />
    <Copy SourceFiles="@(DocFileItem)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" Condition="'$(_DocumentationFileProduced)'=='true'" />
    <Copy SourceFiles="@(IntermediateSatelliteAssembliesWithTargetPath)" DestinationFiles="@(IntermediateSatelliteAssembliesWithTargetPath->'$(WebProjectOutputDir)\bin\%(Culture)\$(TargetName).resources.dll')" SkipUnchangedFiles="true" />
    <Copy SourceFiles="@(ReferenceComWrappersToCopyLocal); @(ResolvedIsolatedComModules); @(_DeploymentLooseManifestFile); @(NativeReferenceFile)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" />
    <!-- copy any referenced assemblies to _PublishedWebsites\app\bin folder -->
    <Copy SourceFiles="@(ReferenceCopyLocalPaths)" DestinationFiles="@(ReferenceCopyLocalPaths->'$(WebProjectOutputDir)\bin\%(DestinationSubDirectory)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
    <!-- Copy content files recursively to _PublishedWebsites\app\ folder -->
    <Copy SourceFiles="@(Content)" DestinationFolder="$(WebProjectOutputDir)\%(Content.RelativeDir)" />
    <!-- Copy items that have been marked to be copied to the bin folder -->
    <Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectory)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="true" />
    <Copy SourceFiles="@(_SourceItemsToCopyToOutputDirectoryAlways)" DestinationFolder="$(WebProjectOutputDir)\bin" SkipUnchangedFiles="false" />
  </Target>

所以,在TC版本中,我使用这样的MSBUILD构建器:

Targets: Rebuild;Publish

Command line parameters: /p:WebProjectOutputDir="%system.teamcity.build.workingDir%\Website"

然后,您可以使用Website目录作为工件。