Skip to content

Instantly share code, notes, and snippets.

@OliverRC
Created August 14, 2013 09:01
Show Gist options
  • Save OliverRC/6229206 to your computer and use it in GitHub Desktop.
Save OliverRC/6229206 to your computer and use it in GitHub Desktop.
TeamCity - CS Project
<PropertyGroup>
<WorkingDir Condition="'$(WorkingDir)' == ''">$(MSBuildProjectDirectory)\..\..\</WorkingDir>
<BuildDir Condition="'$(BuildDir)' == ''">$(WorkingDir)build\</BuildDir>
</PropertyGroup>
<Target Name="ValidateBuildProperties">
<Error Text="The WorkingDir property is not defined." Condition="'$(WorkingDir)' == ''" />
<Error Text="The WorkingDir must have a trailing slash." Condition="!HasTrailingSlash('$(WorkingDir)')" />
<Error Text="The BuildDir property is not defined." Condition="'$(BuildDir)' == ''" />
<Error Text="The BuildDir must have a trailing slash." Condition="!HasTrailingSlash('$(BuildDir)')" />
</Target>
<Target Name="AfterBuild">
<ItemGroup>
<TargetArtifacts Include="$(TargetDir)**\*.*" />
<TargetArtifacts Remove="$(TargetDir)*.vshost.exe*" />
<TargetArtifacts Remove="$(TargetPath).*.xml" />
<TargetArtifacts Remove="$(TargetPath).lastcodeanalysissucceeded" />
</ItemGroup>
<Copy SourceFiles="@(TargetArtifacts)"
DestinationFolder="$(BuildDir)$(AssemblyName)\bin\%(RecursiveDir)"
SkipUnchangedFiles="true" />
<Copy SourceFiles="@(TargetArtifacts)"
DestinationFolder="$(BuildDir)bin\%(RecursiveDir)"
SkipUnchangedFiles="true" />
</Target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment