A guide for testing package changes without publishing to nuget.org, and switching cleanly between local and published packages.
Pack the project and point NuGet at a local directory:
# Build and pack the package
dotnet pack -c Release -o C:\local-nuget
# In the consuming project, add the local feed
dotnet nuget add source C:\local-nuget --name localOr add it to nuget.config in the consuming project:
<configuration>
<packageSources>
<add key="local" value="C:\local-nuget" />
</packageSources>
</configuration>Then reference it normally in the .csproj:
<PackageReference Include="YourPackage" Version="1.0.0" />Skip packaging entirely during development:
<ItemGroup>
<ProjectReference Include="..\YourLibrary\YourLibrary.csproj" />
</ItemGroup>Switch back to PackageReference once the package is stable. This is the fastest feedback loop but does not test the actual package behavior (assembly loading, transitive dependencies, etc.).
Install NuGet Package Explorer to inspect .nupkg file contents before consuming the package anywhere.
Publish a prerelease version to a private feed (GitHub Packages, Azure Artifacts, or MyGet) instead of nuget.org:
<Version>1.2.3-beta.1</Version>Update the version in your .csproj to a version that exists on nuget.org. NuGet checks all configured sources and pulls from whichever one satisfies the version.
To remove the local source:
dotnet nuget remove source localOr delete the entry from nuget.config manually.
NuGet caches packages in %USERPROFILE%\.nuget\packages. If your local test package and the real release share the same version number, NuGet may use the cached local copy. Force a clean resolution with:
dotnet nuget locals all --clear
dotnet restoreUse a higher or prerelease version for local test packages (e.g. 1.0.1-local) to avoid this ambiguity entirely, making the switch back to nuget.org as simple as changing the version number.