Download Nuget Packages Without VS/NuGet Package Manager

后端 未结 6 1837
盖世英雄少女心
盖世英雄少女心 2021-02-01 04:01

How can I download NuGet Packages outside of visual studio? so it can be used to create offline packages.

6条回答
  •  借酒劲吻你
    2021-02-01 04:28

    Here are a few examples that can add to DeePak's answer:

    This one downloads AutoMapper from NuGet.org

    nuget.exe install AutoMapper  -OutputDirectory c:\Temp\LotsOfPackages -Version 6.2.2
    

    This one downloads MyCustomPackage from an internal TFS Nuget feed

    nuget.exe install MyCustomPackage  -OutputDirectory c:\Temp\LotsOfPackages -Source "http://tfs.myCompany.com:8080/tfs/TFSArea/_packaging/FeedName/nuget/v3/index.json" -Version 1.0.0.2
    

    Notes

    • Keep in mind that the install command will get the package in question AND all its NuGet dependencies. So, be careful about just dumping this into the directory where you running. Thus, I added OutputDirectory to the command.
    • For internal Nuget packages/feeds, the Source URL is available via TFS. Go to your packages tab and find your specific feed URL. If it has any spaces that have been encoded with %20, you need to replace them with spaces.
    • CLI command reference
    • Copy packages from one NuGet feed to another

提交回复
热议问题