Created
January 19, 2016 11:14
-
-
Save citizenmatt/c30645222bc48bb2b085 to your computer and use it in GitHub Desktop.
De-duplicate msbuild references
This file contains hidden or 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="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<!-- For some reason, msbuild will sometimes duplicate all references in @(ReferencePath), | |
which, given a particularly meaty nuget package (*cough*JetBrains.ReSharper.SDK*cough*), | |
can overwhelm the command line. This little hack will de-duplicate references to | |
reduce the pressure, but it's still going to hurt at some point... | |
I'd really like to figure out why msbuild is duplicating. Given a simple test with | |
just e.g. nunit, it works as expected. Perhaps it's something to do with the ReSharper | |
SDK nuget, but I can't see it --> | |
<PropertyGroup> | |
<CoreCompileDependsOn> | |
$(CoreCompileDependsOn); | |
_RemoveDuplicateReferences | |
</CoreCompileDependsOn> | |
</PropertyGroup> | |
<Target Name="_RemoveDuplicateReferences"> | |
<ItemGroup> | |
<_DeduplicatedReferencePath /> | |
</ItemGroup> | |
<RemoveDuplicates Inputs="@(ReferencePath)"> | |
<Output TaskParameter="Filtered" | |
ItemName="_DeDuplicatedReferencePath"/> | |
</RemoveDuplicates> | |
<ItemGroup> | |
<ReferencePath Remove="@(ReferencePath)" /> | |
<ReferencePath Include="@(_DeduplicatedReferencePath)" /> | |
</ItemGroup> | |
</Target> | |
</Project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment