Skip to content

Instantly share code, notes, and snippets.

@AlexVallat
Created March 4, 2021 18:33
Show Gist options
  • Save AlexVallat/1e9f7bfd787912cef39dafce036ccb4a to your computer and use it in GitHub Desktop.
Save AlexVallat/1e9f7bfd787912cef39dafce036ccb4a to your computer and use it in GitHub Desktop.
Auto override Nugets with local assembly references for local development
<Project>
<ItemGroup>
<!-- Customise this section to list all the locally developed nugets and which locally built assembly they should be replaced by -->
<_ReplacePackageReference Include="Some.Locally.Developed.Nuget" HintPath="C:\Dev\SomeLocalDevFolder\bin\Debug\netstandard2.1\Some.Locally.Developed.Nuget.dll" />
<_ReplacePackageReference Include="Another.Package" HintPath="C:\Dev\SomeOtherDevFolder\bin\Debug\netstandard2.1\Another.dll" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)' == 'DEBUG'">
<_UnwantedReplacements Include="@(_ReplacePackageReference)" Exclude="@(PackageReference)" />
<_PackagesToReplace Include="@(_ReplacePackageReference)" Exclude="@(_UnwantedReplacements)" />
<Reference Include="@(_PackagesToReplace)" />
<PackageReference Remove="@(_PackagesToReplace)" />
</ItemGroup>
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment