Home: NuGet.exe install without a project should not validate the PackageType metadata

Created on 19 Apr 2018  路  7Comments  路  Source: NuGet/Home

Details about Problem

NuGet product used (NuGet.exe): NuGet.exe

NuGet version (x.x.x.xxx): 4.6.2.5055

dotnet.exe --version (if appropriate):

VS version (if appropriate):

OS version (i.e. win10 v1607 (14393.321)): win10 1709 16299.309

Worked before? If so, with which NuGet version: haven't had the need before. I know it works when using the nuget package manager console in VS

Detailed repro steps so we can see the same problem

  1. nuget.exe install NupkgWrench -IgnoreDependencies

Other suggested things

Verbose Logs

D:\test> nuget install nupkgwrench -source nuget.org -IgnoreDependencies -Verbosity detailed
Unknown option: '-IgnoreDependencies'
NuGet.CommandLine.CommandLineException: Unknown option: '-IgnoreDependencies'
   at NuGet.CommandLine.CommandLineParser.GetPartialOptionMatch[TVal](IEnumerable`1 source, Func`2 getDisplayName, Func`2 getAltName, String option, String value)
   at NuGet.CommandLine.CommandLineParser.ExtractOptions(ICommand command, IEnumerator`1 argsEnumerator)
   at NuGet.CommandLine.CommandLineParser.ParseCommandLine(IEnumerable`1 commandLineArgs)
   at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
D:\test>

Sample Project

Not applicable, any nuget package will do

*Update by @nkolev92 *

Running

nuget install nupkgwrench -DependencyVersion Ignore
errors out with
Error NU5000: Package 'NupkgWrench 1.3.0' has a package type 'DotnetCliTool' that is not supported by project 'E:tmp'.

This is probably not needed because the intention here is to just download said nupkg, and there's no project or a packages.config.

Install Icebox 2 NuGet.exe Packages.Config help wanted

All 7 comments

and fyi, the docs for the CLI suggested this got posted:
https://docs.microsoft.com/en-us/nuget/tools/cli-ref-install:
image

And as a final touch, the docs for the package manager console claims the following:
image
See https://docs.microsoft.com/en-us/nuget/tools/package-manager-console

-DependencyVersion Ignore should handle this, I think it was added in 4.6

Using that I get an error now that nuget checks the package type, so it is still blocked.
Error NU5000: Package 'NupkgWrench 1.3.0' has a package type 'DotnetCliTool' that is not supported by project 'E:\tmp'.

@dschuermans
You're effectively looking for a way to just download a nupkg and then run the executable?

@emgarten
Global tools maybe? :)
I think the package type checking has been there since 4.x

The scenario being asked for here is not a bug, but nupkgwrench in particular won't work because it's a dotnetclitool.

@nkolev92 - That assumption is correct. Although it could be rephrased as "I'm looking for a way to download a nupkg and use something that is contained within that nupkg." Doesn't have to be an executable 馃槈

Thanks for clarifying it @dschuermans

Here's the status right now:

  • The ability to download a single package without any package type/project type/dependency restrictions is tracked in https://github.com/NuGet/Home/issues/5919.

  • The correct approach for netcore executable assemblies is global tools - More info This is how executable should be packaged, and how executables should be shipped.

  • As @emgarten mentioned earlier, there's DependecyVersion Ignore which covers the original ask to download a package with dependencies.

Now lastly, the issue is that there's PackageType validation in simple NuGet install where you're not installing to a project. That package validation is not necessary for this scenario in my opinion.

I'm going to change this issue name and description into that.

Does that sound good?

@nkolev92 perfect :) thanks for the clarification!

Was this page helpful?
0 / 5 - 0 ratings