Created
November 1, 2013 10:38
-
-
Save cchitsiang/7263662 to your computer and use it in GitHub Desktop.
Copying linked content files at each build using MSBuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--http://mattperdeck.com/post/Copying-linked-content-files-at-each-build-using-MSBuild.aspx--> | |
<Target Name="CopyLinkedContentFiles" BeforeTargets="Build"> | |
<Copy SourceFiles="%(Content.Identity)" | |
DestinationFiles="%(Content.Link)" | |
SkipUnchangedFiles='true' | |
OverwriteReadOnlyFiles='true' | |
Condition="'%(Content.Link)' != ''" /> | |
</Target> | |
<!-- | |
This target uses BeforeTargets to ensure it is executed each time a build happens, even when no files in the project need to be built. | |
The Copy task uses a Condition to filter out all items in the Content item group that do not have a Link meta. This way, the copy is only applied to links. To speed up the process, it sets SkipUnchangedFiles to true, so if a linked file has not been changed, it won't be copied. | |
--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This is linked file --> | |
<Content Include="..\..\JSNLog\Scripts\jsnlog.js"> | |
<Link>Scripts\jsnlog\jsnlog.js</Link> | |
</Content> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you. Only solution so far which worked for me.