I use nexus nuget repository and I want to get my version information list
I use nuget.exe and get all version information if I not use -allversion point I access latest versions
nuget.exe list -Source http://xxxxx/nexus/service/local/nug
et/RepoName/ -allversion
But I want to access specific versions,I give the versionnumber and I want get package list which their version number
Is It possible to do something like that
nuget.exe list -Source http://xxxxx/nexus/service/local/nug
et/RepoName/ -version 1.0.1
and returns
A 1.0.1
B 1.0.1
C 1.0.1 in the repository ...
I don't believe that nuget.exe supports the -version flag:
$ nuget.exe list -?
usage: NuGet list [search terms] [options]
Displays a list of packages from a given source. If no sources are specified, all sources defined in %AppData%\NuGet\NuGet.config are used. If NuGet.config specifies no sources, uses the default NuGet feed.
Specify optional search terms.
options:
-Source + A list of packages sources to search.
-Verbose Displays a detailed list of information for each package.
-AllVersions List all versions of a package. By default, only the latest package version is displayed.
-Prerelease Allow prerelease packages to be shown.
-Help (?) help
-Verbosity Display this amount of details in the output: normal, quiet, detailed.
-NonInteractive Do not prompt for user input or confirmations.
-ConfigFile The NuGet configuration file. If not specified, file %AppData%\NuGet\NuGet.config is used as configuration file.
For more information, visit http://docs.nuget.org/docs/reference/command-line-reference
But, you could use an OData query against the nuget gallery service to get what you are looking for. e.g.
http://xxxx/nexus/service/local/nuget/RepoName/Packages()?$filter=Version%20eq%20'1.0.1'
Related
I know that the NuGet packages are there. I can list them on my Artifactory page. Why can't my nuget restore command see them?
I have a server at JFrog Artifactory. Let's say the URL is https://companyname.jfrog.io/artifactory.
I have a NuGet package repository at that location. The repository is called 'repo-name-local'.
My NuGet packages show up as they should at https://companyname.jfrog.io/ui/repos/tree/General/repo-name-local
... and they appear in the repository listing at https://companyname.jfrog.io/ui/repos/tree/General/repo-name-local
On that page, the "URL to file" is given as https://companyname.jfrog.io/artifactory/repo-name-local/.
I expect these three PowerShell commands to execute successfully:
# Start with a clean nuget.config
git checkout nuget.config
# Add package source, username, password
.\nuget.exe sources add -name "Artifactory" -source https://companyname.jfrog.io/artifactory/api/nuget/repo-name-local/ -username foo -password bar -configfile .\nuget.config
# Restore packages
.\nuget.exe restore -Source "https://companyname.jfrog.io/artifactory/api/nuget/repo-name-local/;https://www.nuget.org/api/v2" -ConfigFile .\nuget.config -Verbosity detailed .\Something\Something.sln
The first two commands execute successfully, but the third one gives this response:
WARNING: Unable to find version '31.3.0.1035' of package 'GemBox.Spreadsheet'.
C:\Users\rdepew\.nuget\packages\: Package 'GemBox.Spreadsheet.31.3.0.1035' is not found on source 'C:\Users\rdepew\.nuget\packages\'.
https://companyname.jfrog.io/artifactory/api/nuget/repo-name-local/: Package 'GemBox.Spreadsheet.31.3.0.1035' is not found on source 'https://companyname.jfrog.io/artifactory/api/nuget/repo-name-local/'.
https://www.nuget.org/api/v2: Package 'GemBox.Spreadsheet.31.3.0.1035' is not found on source 'https://www.nuget.org/api/v2'.
I thought that the modified URL was required, but maybe it wasn't. So I change the commands a bit:
# Start with a clean nuget.config
git checkout nuget.config
# Add package source, username, password
.\nuget.exe sources add -name "Artifactory" -source https://companyname.jfrog.io/artifactory/repo-name-local/ -username foo -password bar -configfile .\nuget.config
# Restore packages
.\nuget.exe restore -Source "https://companyname.jfrog.io/artifactory/repo-name-local/;https://www.nuget.org/api/v2" -ConfigFile .\nuget.config -Verbosity detailed .\Something\Something.sln
The response is slightly different, but still not successful:
WARNING: Unable to find version '31.3.0.1035' of package 'GemBox.Spreadsheet'.
C:\Users\rdepew\.nuget\packages\: Package 'GemBox.Spreadsheet.31.3.0.1035' is not found on source 'C:\Users\rdepew\.nuget\packages\'.
https://companyname.jfrog.io/artifactory/repo-name-local/: Failed to fetch results from V2 feed at 'https://companyname.jfrog.io/artifactory/repo-name-local/FindPackagesById()?id='GemBox.Spreadsheet'&semVerLevel=2.0.0' with following message : Response status code does not indicate success: 404 (Not Found).
Response status code does not indicate success: 404 (Not Found).
https://www.nuget.org/api/v2: Package 'GemBox.Spreadsheet.31.3.0.1035' is not found on source 'https://www.nuget.org/api/v2'.
Why are both nuget restore commands failing? Why can't they see the repository contents?
I hit to the similar issue, resolved by enabling force authentication for nuget repo.
Nuget Settings
I am trying to use NuGet to package and publish the package with TFS Build 2015 to local NuGet Server. I am getting error , I am not sure what am i missing. Thanks for Help.
Here is Error
Starting task: NuGet Packager
Set workingFolder to default: C:\Lucky\agent\tasks\NuGetPackager\0.1.58
Executing the powershell script: C:\Lucky\agent\tasks\NuGetPackager\0.1.58\NuGetPackager.ps1
Checking pattern is specified
No Pattern found in solution parameter.
Found files: 1
--File: "C:\Lucky\agent_work\1\s\Dev\FabrikamFiber.CallCenter"
The property DirectoryName does not exist or was not found.
Creating Nuget Arguments:
--ARGS: pack "C:\Lucky\agent_work\1\s\Dev\FabrikamFiber.CallCenter" -OutputDirectory "C:\Lucky\agent_work\1\s" -Properties Configuration=Release
Invoking nuget with pack "C:\Lucky\agent_work\1\s\Dev\FabrikamFiber.CallCenter" -OutputDirectory "C:\Lucky\agent_work\1\s" -Properties Configuration=Release on
C:\Lucky\agent\agent\worker\tools\NuGet.exe pack "C:\Lucky\agent_work\1\s\Dev\FabrikamFiber.CallCenter" -OutputDirectory "C:\Lucky\agent_work\1\s" -Properties Configuration=Release
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
Please specify a nuspec or project file to use.
Unexpected exit code 1 returned from tool NuGet.exe
Finishing task: NuGetPackager
Task NuGetPackager failed. This caused the job to fail. Look at the logs for the task for more details.
According to the error info:
Please specify a nuspec or project file to use. Unexpected exit code 1
returned from tool NuGet.exe
You may specified a wrong argument in nuget package task ,please double check you have followed below requirements:
Specify .csproj files (for example, **\*.csproj) for simple projects. In this case:
The packager compiles the .csproj files for packaging.
You must specify Configuration to Package (see below).
You do not have to check in a .nuspec file. If you do check one in, the packager honors its settings and replaces tokens such as $id$ and
$description$.
Specify .nuspec files (for example, **\*.nuspec) for more complex projects, such as multi-platform scenarios in which you need to
compile and package in separate steps. In this case:
The packager does not compile the .csproj files for packaging.
Each project is packaged only if it has a .nuspec file checked in.
The packager does not replace tokens in the .nuspec file (except the element, see Use build number to version package,
below). You must supply values for elements such as and
. The most common way to do this is to hardcode the
values in the .nuspec file.
Please double check your arguments , more details please refer this tutorial-- Pack NuGet packages.
Besides you could also enable verbose debug mode by adding system.debug=true to get a more detail build log info for troubleshooting.
Using TFS 2015.3 I am trying to create nuget packages to share internally with TFS out-of-the-box Nuget Packager Task. However, it does not create packages and errors out complaining "Access is denied". Inline are its log
2017-04-12T20:46:59.3533843Z Set workingFolder to default: C:\Downloads\TFS Agent installer\agent\tasks\NuGetPackager\0.1.58
2017-04-12T20:46:59.3846316Z Executing the powershell script: C:\Downloads\TFS Agent installer\agent\tasks\NuGetPackager\0.1.58\NuGetPackager.ps1
2017-04-12T20:46:59.6033861Z Getting version number from build
2017-04-12T20:46:59.6033861Z BUILD_BUILDNUMBER: 0.1.0.12
2017-04-12T20:46:59.6346370Z Version: 0.1.0.12
2017-04-12T20:46:59.6346370Z Checking pattern is specified
2017-04-12T20:46:59.6502638Z No Pattern found in solution parameter.
2017-04-12T20:46:59.6502638Z Found files: 1
2017-04-12T20:46:59.6502638Z --File: "E:\WebWork\10\s\Dev\DDS\DDSCommon\DDSCommon.csproj"
2017-04-12T20:46:59.6502638Z Creating Nuget Arguments:
2017-04-12T20:46:59.6658895Z --ARGS: pack "E:\WebWork\10\s\Dev\DDS\DDSCommon\DDSCommon.csproj" -OutputDirectory "\\Server\Nuget\DDS\" -Properties Configuration=Release -version 0.1.0.12
2017-04-12T20:46:59.6658895Z Invoking nuget with pack "E:\WebWork\10\s\Dev\DDS\DDSCommon\DDSCommon.csproj" -OutputDirectory "\\Server\Nuget\DDS\" -Properties Configuration=Release -version 0.1.0.12 on E:\WebWork\10\s\Dev\DDS\DDSCommon
2017-04-12T20:46:59.6658895Z \\Server\nuget\ pack "E:\WebWork\10\s\Dev\DDS\DDSCommon\DDSCommon.csproj" -OutputDirectory "\\Server\Nuget\DDS\" -Properties Configuration=Release -version 0.1.0.12
2017-04-12T20:46:59.6815141Z ##[error]Access is denied
we are using Internal NuGet Repo which is just a shared directory on our server.
On research could not find any posts related to it. Any suggestions please.
Update from OP
Issue fixed by leave blank of Path to Nuget.exe field.
Path to NuGet.exe
(Optional) Path to your own instance of NuGet.exe. If you specify
this argument, you must have your own strategy to handle
authentication.
According to the error info Access is denied. Please make sure your build service account have enough permission to access \\Server\Nuget\DDS\
Package Folder
(Optional) Specify the folder where you want to put the packages. You
can use a variable such as $(Build.StagingDirectory)\packages
If you leave it empty, the package will be created in the same
directory that contains the .csproj or .nuspec file.
You could also give a try with some other variable or leave it empty of the package folder in the nuget package task. To narrow down if the issue is related to shared directory \\Server\Nuget\DDS\ on your server.
I'm using VSO to package a simple DLL and the publish it to an internal feed, unfortunately during the packaging stage build it reports success but I get no artifact to publish
In the log file on for the publish it states the packing includes invalid arguments (Log 2016-02-27T09:07:35.8808468Z) as a result the publisher can't file any .nupkg file to publish.
I'm not sure where I'm going wrong. Its as if the nuget.exe is the wrong version or do it need to include anything in my solution
this is just a basic .enter image description herecsproj library with one static function for testing the process.
packager log
2016-02-27T09:07:35.2714664Z Set workingFolder to default: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\NuGetPackager\0.1.57
2016-02-27T09:07:35.2714664Z Executing the powershell script: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\tasks\NuGetPackager\0.1.57\NuGetPackager.ps1
2016-02-27T09:07:35.4277177Z Checking pattern is specified
2016-02-27T09:07:35.4433431Z No Pattern found in solution parameter.
2016-02-27T09:07:35.4433431Z Found files: 1
2016-02-27T09:07:35.4589718Z --File: "C:\a\1\s\NugetTestLibrary\NugetTestLibrary.csproj"
2016-02-27T09:07:35.4589718Z Creating Nuget Arguments:
2016-02-27T09:07:35.4589718Z --ARGS: pack "C:\a\1\s\NugetTestLibrary\NugetTestLibrary.csproj" -OutputDirectory "C:\a\1\a" -Properties Configuration=${BuildConfiguration};Platform any cpu
2016-02-27T09:07:35.4589718Z Invoking nuget with pack "C:\a\1\s\NugetTestLibrary\NugetTestLibrary.csproj" -OutputDirectory "C:\a\1\a" -Properties Configuration=${BuildConfiguration};Platform any cpu on C:\a\1\s\NugetTestLibrary
2016-02-27T09:07:35.4747124Z C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\default\agent\worker\tools\NuGet.exe pack "C:\a\1\s\NugetTestLibrary\NugetTestLibrary.csproj" -OutputDirectory "C:\a\1\a" -Properties Configuration=${BuildConfiguration};Platform any cpu
2016-02-27T09:07:35.8808468Z pack: invalid arguments.
2016-02-27T09:07:35.8964722Z usage: nuget pack <nuspec | project> [options]
2016-02-27T09:07:35.8964722Z Creates a NuGet package based on the specified nuspec or project file.
2016-02-27T09:07:35.8964722Z Specify the location of the nuspec or project file to create a package.
2016-02-27T09:07:35.8964722Z options:
2016-02-27T09:07:35.8964722Z -OutputDirectory Specifies the directory for the created NuGet package file. If not specified, uses the current directory.
2016-02-27T09:07:35.8964722Z -BasePath The base path of the files defined in the nuspec file.
2016-02-27T09:07:35.8964722Z -Verbose Shows verbose output for package building.
2016-02-27T09:07:35.8964722Z -Version Overrides the version number from the nuspec file.
2016-02-27T09:07:35.9120964Z -Exclude + Specifies one or more wildcard patterns to exclude when creating a package.
2016-02-27T09:07:35.9120964Z -Symbols Determines if a package containing sources and symbols should be created. When specified with a nuspec, creates a regular NuGet package file and the corresponding symbols package.
2016-02-27T09:07:35.9120964Z -Tool Determines if the output files of the project should be in the tool folder.
2016-02-27T09:07:35.9120964Z -Build Determines if the project should be built before building the package.
2016-02-27T09:07:35.9120964Z -NoDefaultExcludes Prevent default exclusion of NuGet package files and files and folders starting with a dot e.g. .svn.
2016-02-27T09:07:35.9120964Z -NoPackageAnalysis Specify if the command should not run package analysis after building the package.
2016-02-27T09:07:35.9120964Z -ExcludeEmptyDirectories Prevent inclusion of empty directories when building the package.
2016-02-27T09:07:35.9120964Z -IncludeReferencedProjects Include referenced projects either as dependencies or as part of the package.
2016-02-27T09:07:35.9120964Z -Properties + Provides the ability to specify a semicolon ";" delimited list of properties when creating a package.
2016-02-27T09:07:35.9120964Z -MinClientVersion Set the minClientVersion attribute for the created package.
2016-02-27T09:07:35.9120964Z -MSBuildVersion Specifies the version of MSBuild to be used with this command. Supported values are 4, 12, 14. By default the MSBuild in your path is picked, otherwise it defaults to the highest installed version of MSBuild.
2016-02-27T09:07:35.9120964Z -Help (?) help
2016-02-27T09:07:35.9120964Z -Verbosity Display this amount of details in the output: normal, quiet, detailed.
2016-02-27T09:07:35.9120964Z -NonInteractive Do not prompt for user input or confirmations.
2016-02-27T09:07:35.9120964Z For more information, visit http://docs.nuget.org/docs/reference/command-line-reference
Unfortunately I copied the Configuration=${BuildConfiguration} parameter incorrectly (use {} instead of ()), I also had to make other changes , I didn't require the platform parameter. I was also packaging to the incorrect folder.
What NuGet PowerShell command will return a list of all versions of a specific package?
I have tried the following, but it only returns one version of NUnit along with a number of other (un)related packages, each having only one version.
Get-Package -Source https://go.microsoft.com/fwlink/?LinkID=206669 -ListAvailable -Filter NUnit -AllVersions
Note: I specify the source URI because we have our own internal package source as our default remote.
My understanding is that the -AllVersions switch should pull back every version of each matching package.
I can't seem to figure out:
Am I doing it wrong?
If not, are project maintainers (or someone else) removing older versions from the package source?
If they are, why?
Your source resolves to the version 1 of the feed which doesn't seem to work with -AllVersions (I filed an issue: https://github.com/NuGet/NuGetGallery/issues/563)
Using the V2 feed works for me:
get-package -ListAvailable -AllVersions -filter nunit -source https://nuget.org/api/v2/
But note that -filter is not for a specific package, but more like a search term.
As a workaround, I'd use tab autocomplete to get the versions list of a specific package:
install-package -source https://nuget.org/api/v2/ -id nunit -version <tab>
As of version 3.x, get-package -ListAvailable -AllVersions will still work, but will issue the following warning about imminent deprecation:
This Command/Parameter combination has been deprecated and will be removed in the next release. Please consider using the new command that replaces it: 'Find-Package [-Id] -AllVersions'.
In addition, Find-Package supports an -ExactMatch switch which will avoid the wildcard matching issues that -Filter has:
Find-Package NUnit -AllVersions -ExactMatch -Source https://api.nuget.org/v3/index.json
To extend on the already provided solutions and address the follow-up questions by King King and JohnKoz, it is possible to get the full list of versions for a specific package as follows:
Find-Package -AllVersions -source https://nuget.org/api/v2/ Newtonsoft.Json -ExactMatch | foreach { $_.Versions } | Select-Object Version
The package Newtonsoft.Json is an example. Replace it as needed.
It works by first getting all versions for a single package (via -ExactMatch). This returns a package object that has a Versions property, which is an array of version objects. The foreach iterates over all these and the Select-Object ensures that each version object is output as a single line (by only selecting its main property).