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

.NET Core Global Tool support #8631

Closed
karann-msft opened this issue Sep 26, 2019 · 11 comments

Comments

@karann-msft
Copy link
Contributor

@karann-msft karann-msft commented Sep 26, 2019

@kbilsted commented on Fri Sep 20 2019

When targeting multiple frameworks, nuget no longer displays This package contains a .NET Core Global Tool you can call from the shell/command line. and you cannot install your tool through the command line.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@kbilsted

This comment has been minimized.

Copy link

@kbilsted kbilsted commented Sep 26, 2019

You can test the behaviour by adding net452 to the TargetFrameworks of https://github.com/kbilsted/WhitespaceWarrior/blob/master/WhiteSpaceWarrior/WhiteSpaceWarrior.csproj

@nkolev92

This comment has been minimized.

Copy link
Member

@nkolev92 nkolev92 commented Sep 26, 2019

@kbilsted

Can you please clarify where you see that message?

I'm not aware of the NuGet Client emitting any such message.

@kbilsted

This comment has been minimized.

Copy link

@kbilsted kbilsted commented Sep 28, 2019

"This package contains a .NET Core Global Tool you can call from the shell/command line." is displayed here https://www.nuget.org/packages/WhiteSpaceWarrior/

But more importantly, the easy installation in the console (dotnet tool install ...) is not working when you multitarget.

@nkolev92

This comment has been minimized.

Copy link
Member

@nkolev92 nkolev92 commented Sep 30, 2019

Ah, your point was about nuget.org. I will move this issue there.

But more importantly, the easy installation in the console (dotnet tool install ...) is not working when you multitarget.

Can you clarify this?
When you multi target the package?

That's supported and at tool install time, the best matching assets are selected.

@kbilsted

This comment has been minimized.

Copy link

@kbilsted kbilsted commented Sep 30, 2019

Not sure where it belongs. It also ruins the installer through the dotnet

@nkolev92

This comment has been minimized.

Copy link
Member

@nkolev92 nkolev92 commented Sep 30, 2019

@kbilsted

Not sure where it belongs. It also ruins the installer through the dotnet

Can you please clarify this?
I'm not sure I follow. Do you see a failure? What kind of failure do you see?
Thanks.

@kbilsted

This comment has been minimized.

Copy link

@kbilsted kbilsted commented Sep 30, 2019

The v1.0.0 of the tool is build using multitarget both .net core and .net framework. when I install it now i get

PS C:\> dotnet tool install  --version 1.0.0 --tool-path c:\temp  whitespacewarrior
error NU1212: Invalid project-package combination for WhiteSpaceWarrior 1.0.0. DotnetToolReference project style can only contain references of the DotnetTool type
The tool package could not be restored.
Tool 'whitespacewarrior' 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 Core tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.

For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool
@nkolev92

This comment has been minimized.

Copy link
Member

@nkolev92 nkolev92 commented Oct 1, 2019

@kbilsted
1.0.0 seems to be built incorrectly.
NuGet and dotnet rely on a package type to understand which packages are tools.

If you look at the 1.0.1 nuspec it has:

    <packageTypes>
      <packageType name="DotnetTool" />
    </packageTypes>

and if you look at the nuget.org page it has the instruction to install via dotnet tool.
https://www.nuget.org/packages/WhiteSpaceWarrior/1.0.1

On the other hand the 1.0.0 nuspec doesn't have the package type metadata, so it can't be used as a tool.
Similarly the nuget.org tool contains instructions.
https://www.nuget.org/packages/WhiteSpaceWarrior/1.0.0

So based on what I see, the error is as expected and should not be related to the fact that the package contains more than 1 framework.

Note that as far as I'm aware (since dotnet tool is not a feature we own), having a dotnet tool target .NET Framework is not useful, since it will be used.

How was the 1.0.0 tool built?
Custom nuspec?
Maybe there's an issue with PackAsTool?

@kbilsted

This comment has been minimized.

Copy link

@kbilsted kbilsted commented Oct 2, 2019

Yes my bad, if I change the csproj to
<targetframeworks>netcoreapp2.1;net452;net472</targetframeworks> I get the error

Severity	Code	Description	Project	File	Line	Suppression State
Error	NETSDK1054	only supports .NET Core.	WhiteSpaceWarrior	C:\Program Files\dotnet\sdk\3.0.100\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.PackTool.targets	77	
@nkolev92

This comment has been minimized.

Copy link
Member

@nkolev92 nkolev92 commented Oct 3, 2019

@kbilsted

Are all your concerns addressed here?

Feel free to close if so, happy to help more if needed.

@nkolev92

This comment has been minimized.

Copy link
Member

@nkolev92 nkolev92 commented Nov 8, 2019

Closing per the above comments.

@nkolev92 nkolev92 closed this Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.