I had to be able to switch from a direct DLL reference to a NuGet package based on a <Condition>
of my Project (csproj) file.
It can be achieved with <Choose><When><Otherwise>
.
Open the .csproj with your favorite editor.
<!--When in Debug mode, use direct DLL's else use the NuGet--> <Choose> <When Condition="'$(Configuration)' == 'Debug'"> <ItemGroup> <Reference Include="My.Project"> <HintPath>bin\Debug\netcoreapp3.1\My.Project.dll</HintPath> </Reference> </ItemGroup> </When> <Otherwise> <ItemGroup> <PackageReference Include="My.Project" Version="1.0.0-beta" /> </ItemGroup> </Otherwise> </Choose>