Nuget packages in local operation

We have several projects in our product. almost every one of them depends on one called the "core". We distribute each project as a separate nuget package. And for deployment, our work for other teams / products nuget works fine, it is a very big pain during our local work.

Every time the "core" project changes, we need to rebuild it, build nuget, publish it in some repository, and then do restoration in other projects. It takes time. And sometimes we need to make changes to the kernel in a few iterations. Before we create build-publish nuget-update nuget circle again and again

The best solutions that we have found so far are to switch links to links to links to projects during our local work and switch them back to nuget when we want to publish it.

But we are not sure if this is the best way.

So, what is the best way to handle nugget references in two local projects without making work harder?

thank

+5
source share
4 answers

What is the best way to handle nuget references in two local projects without complicating the job?

NuGet Microsoft, , . , , , , nuget, . . , - .

- , . , . , .

, , . - , , nuget , .

+4

, , , script, Nuget , .

, , , Nuget

...

:

  • Nuget
  • script /packages , Nuget.
  • Enjoy

Powershell script, - :

$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
    }
}

DLL Visual Studio - , , : o)

+1

NuGet 3.3, , NuGet. " ", "nuget init source dest", "source" - , *.nupkg ". NuGet Server C:\LocalNuGet, , NuPkg (flat), :

nuget init c:\source c:\localnuget

, ,

https://github.com/NuGet/NuGetGallery/wiki/Hosting-the-NuGet-Gallery-Locally-in-IIS

http://haacked.com/archive/2010/10/21/hosting-your-own-local-and-remote-nupack-feeds.aspx/

0

Node (. npm link).

: " " . , , .

For some reason, NuGet still does not have a link function . There is a function request https://github.com/NuGet/Home/issues/1821 that indicates that they have no plans to add it.

In the meantime, I created a tool that works similarly to the npm link for NuGet packages, you can try it: https://www.nuget.org/packages/NuLink

0
source

Source: https://habr.com/ru/post/1672824/


All Articles