David Laing
David Laing

Reputation: 7675

How do I add a generated file to the _PublishedWebsites folder as part of a TFS build?

I have a custom task in my Web Application Project that generates some metadata files.

How can I ensure that these files are copied into the _PublishedWebsites\ folder by the TFS build?

Upvotes: 2

Views: 1510

Answers (1)

David Laing
David Laing

Reputation: 7675

Simple - add a copy task to to the AfterBuild target in your .csproj file:

<Target Name="AfterBuild">

    <!-- Copy metadata to _PublishedWebsites -->
<Copy Condition="('%(MetadataGenerationExitCode.identity)' == '0') And ('$(IsDesktopBuild)' == 'False')"
      SourceFiles="$(OutDir)\Metadata\schema.json.js;$(OutDir)\Metadata\smd.json.js;" 
      DestinationFolder="$(OutDir)_PublishedWebsites\$(MSBuildProjectName)\Metadata" 
      SkipUnchangedFiles="false" />

 </Target>

Thanks to lexx for putting me on the right track.

Upvotes: 1

Related Questions