Search code examples
nugetnuget-package-restorenuget-server

Private nuget repositroy deleting extra copied nupkg file in outputDIrectory


I'm having a private nuget repository. From this reposiory i'm downloading and extracting the nupkg using the below command

nuget install testspec -Source <url> -Exclude -OutputDirectory "c:\temp"

So it create a folder call testspec inside c:\temp and extract the content of nupkg inside that.

But i get the copy of the package also present in the same folder after extraction. What I mean to say, c:\temp\testspec I'm able to find testspec.nupkg.

How do i avoid copying the nupkg file or a copy here? Is there any flag i can set during the installation of nuget command?


Solution

  • You need to use the -PackageSaveMode flag in the install command. package save mode flag allows you to select if you want to save the package nuspec, nupkg or both. You can read more about it [here][1].

    In your case you can pass -PackageSaveMode nuspec and that will prevent the nupkg from being saved onto the disk.E.g. -

    nuget install testspec -Source <url> -Exclude -OutputDirectory "c:\temp" -PackageSaveMode nuspec