What I've done in the past was to write a small script that overwrites your Nuget binaries with binaries that you have just compiled.
This way you work around the overhead of packing, distributing and restoring packages every time you change a single character in your Nuget package
...without changing project references in your consuming project
The workflow goes:
- Code and build Nuget binaries
- Run script overwriting binaries in the /packages folder in the project consuming your Nuget package
- Enjoy
I've whipped together a Powershell script that does the job - I use it myself from time to time:
$ErrorActionPreference = 'Stop'
$SourceBasePath = 'C:\Projects\MyNugetPackage\Main'
$TargetBasePath = 'C:\Projects\MyNugetConsumer\Main'
$Configuration = 'bin\debug'
#0 = Source DLL
#1 = Source location in $SourceBasePath
$maps = @(
,@('SomeBinary.dll', 'Foo\Bar')
,@('AnotherBinary.dll', 'Bar\Baz')
)
foreach($map in $maps) {
#Find all packages that contains a copy of the source binary
$targets = Get-ChildItem "$TargetBasePath\$($map[1].Split('\')[0])\packages" -Filter $map[0] -Recurse
foreach($target in $targets) {
$sourcePathDll = "$SourceBasePath\$($map[1])\$Configuration\$($map[0])"
$targetPathDll = Join-Path $target.Directory.FullName $map[0]
$sourcePathPdb = $sourcePathDll.Replace('.dll', '.pdb')
$targetPathPdb = $targetPathDll.Replace('.dll', '.pdb')
Write-Host ''
Write-Host $sourcePathDll
Write-Host $targetPathDll
Write-Host $sourcePathPdb
Write-Host $targetPathPdb
if (!(Test-Path $sourcePathDll)) {
throw "Source not found: ", $sourcePathDll
}
if (!(Test-Path $targetPathDll)) {
throw "Target not found: ", $targetPathDll
}
copy $sourcePathDll $targetPathDll
copy $sourcePathPdb $targetPathPdb
}
}
You can run into issues with Visual Studio locking the DLL's - there's no such thing as a free lunch I guess :o)