Use PackageReference in *.csproj files
I recently learnt that a *.csproj file that uses:
<Reference Include="Foo.Bar" Version="0.0.0">
<HintPath>..\..\packages\Foo.Bar.0.0.0\lib\net46\Foo.Bar.dll</HintPath>
</Reference>
can be modified to use:
<PackageReference Include="Foo.Bar" Version="0.0.0" />
and this gives the advantages:
having both
nuget restoreanddotnet restorecommands workingone place to define dependencies instead of dealing with
packages.configfiles in every project.prevents errors from mismatched
HintPathvaluesshould be able to use a
Directory.Packages.propsfile to define the dependency versions once for the entire solution* (I haven't tried this one particularly tbh, but I don't see why not)*
I used to think that we needed to upgrade the *.csproj SDK format from 2003 to have this functionality but seeing it work with the same format is a huge eye opener.
I think all legacy .NET framework projects could begin doing this to gain an advantage.