Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation failure for a package with multiple types #26146

Open
brandom-msft opened this issue Jun 21, 2022 · 3 comments
Open

Installation failure for a package with multiple types #26146

brandom-msft opened this issue Jun 21, 2022 · 3 comments
Assignees

Comments

@brandom-msft
Copy link

Describe the bug

In our current setup, we publish our project as a "dotnet tool". Recently we've had a customer ask that we publish it as a "Dependency" as well, so they can take a standard dependency on it in their project setup.

The NuGet docs specify that one or more types are supported so I updated our package, but now installation via dotnet tool fails. (error output below)

Are multiple package types not supported by dotnet tool?

To Reproduce

Modified property in our *.csproj file to:
<PackageType>Dependency;DotnetTool</PackageType>

Attempted install command:

dotnet tool --prerelease --ignore-failed-sources --add-source /mnt/vss/_work/1/s --global Microsoft.CognitiveServices.Speech.CLI

Exceptions (if any)

Error output:

/tmp/3x3ko4cy.ns2/restore.csproj : error NU1102: Unable to find package Microsoft.CognitiveServices.Speech with version (= <version.num>)
/tmp/3x3ko4cy.ns2/restore.csproj : error NU1102:   - Found 32 version(s) in nuget.org [ Nearest version: 1.22.0 ]
/tmp/3x3ko4cy.ns2/restore.csproj : error NU1102:   - Found 0 version(s) in /mnt/vss/_work/1/s
The tool package could not be restored.

Tool 'microsoft.cognitiveservices.speech.cli' failed to install. This failure may have been caused by:
     * You are attempting to install a preview release and did not use the --version option to specify the version.
     * A package by this name was found, but it was not a .NET tool.
     * The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
     * You mistyped the name of the tool
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Tools untriaged Request triage from a team member labels Jun 21, 2022
@KalleOlaviNiemitalo
Copy link
Contributor

According to NuGet/Home#6298 (comment), packages can have multiple types in general, but the DotnetTool package type does not allow other types. Not sure whether that is in any maintained documentation.

@baronfel
Copy link
Member

baronfel commented Jun 22, 2022

The SDK-bundled tool packaging targets could also do some validation here - throwing an error if you're trying to pack a tool with multiple PackageTypes. We already have a validation target that would be a natural place for it.

@joeloff
Copy link
Member

joeloff commented Jun 29, 2022

This sounds like a bug to me. I think for dotnet tool, the package types must include DotnetTool and only report an error if it does not contain DotnetTool.

@joeloff joeloff removed the untriaged Request triage from a team member label Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants