Skip to content

Instantly share code, notes, and snippets.

@markryd
Created February 28, 2018 04:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markryd/5007052549ff3ea0c4f40c7ca7a7b6fa to your computer and use it in GitHub Desktop.
Save markryd/5007052549ff3ea0c4f40c7ca7a7b6fa to your computer and use it in GitHub Desktop.
Build task to fail on duplicate package references
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Error Text="A package is referenced more than once, check the csproj and remove the duplicate reference." Condition="@(PackageReference->Count()) != @(PackageReference->Distinct()->Count())" />
</Target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment