Copy linked files in VS

2/25/2015 6:04:01 PM

Adding linked files in visual studio makes the files take part in the build and in the vs edit but it does not actually reside in the local projects folder.

We can make visual studio copy linked files upon project build by adding the following at the end of the csproj files.

<!-- THIS PART ENSURES THAT LINKED FILES GETS COPIED (ON BUILD) TO THE PATH (ON DISK) WHERE THE LINK POINTS (IN CSPROJ > CONTENT > LINK) -->
  <Target Name="CopyLinkedContentFiles" BeforeTargets="Build">
    <Copy SourceFiles="%(Content.Identity)" 
          DestinationFiles="%(Content.Link)" 
          SkipUnchangedFiles='true' 
          OverwriteReadOnlyFiles='true' 
          Condition="'%(Content.Link)' != ''" />
 </Target>