Last active
May 19, 2016 07:20
-
-
Save RhysC/63c0b80182ec65f8517eeb95067ffb2c to your computer and use it in GitHub Desktop.
Getting pesky linked DLLs in to the bin dir without subfolders (MSBUILD in csproj files)
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- pervious msbuild project cruft clipped this is just a .csproj--> | |
<ItemGroup> | |
<Content Include="..\OtherProject\libs\**\*.dll"> | |
<Link>libs\%(RecursiveDir)%(Filename)%(Extension)</Link> | |
<!-- copy after the build so i can have the dlls in a linked lib folder in the project bt in the root in bin --> | |
<CopyToOutputDirectory>Never</CopyToOutputDirectory> | |
</Content> | |
</ItemGroup> | |
<Target Name="BeforeBuild"> | |
<!-- this copies the linked files over to your project pre build --> | |
<Copy SourceFiles="%(Content.Identity)" DestinationFiles="%(Content.Link)" SkipUnchangedFiles="true" OverwriteReadOnlyFiles="true" Condition="'%(Content.Link)' != ''" /> | |
</Target> | |
<Target Name="AfterBuild"> | |
<!-- this copies the dlls to your bin without having an added /lib/ folder (that wont be picked up at run time) --> | |
<Copy SourceFiles="$(ProjectDir)\libs\mybinary1.dll" DestinationFolder="$(OutputPath)" ContinueOnError="false" /> | |
<Copy SourceFiles="$(ProjectDir)\libs\mybinary2.dll" DestinationFolder="$(OutputPath)" ContinueOnError="false" /> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment