atifaziz / t5

T5 is T4 (Text Template Transformation Toolkit) for .NET Core
MIT License
79 stars 17 forks source link

Publish as a .NET Core (2.1) Global Tool #3

Closed atifaziz closed 5 years ago

atifaziz commented 6 years ago

T5.TextTransform.Tool is currently available for .NET Core as dotnet-tt using the CLI tools extensibility model. .NET Core 2.1 introduces .NET Core Global Tools but which seems incompatible. Running dotnet tool install -g T5.TextTransform.Tool ends up in the following error:

error NU1212: Invalid project-package combination for T5.TextTransform.Tool 1.1.0. DotnetToolReference project style can only contain references of the DotnetTool type 
dotnet : The tool package could not be restored.
At line:1 char:1
+ dotnet tool install -g T5.TextTransform.Tool
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (The tool package could not be restored.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Tool 't5.texttransform.tool' 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 th
is 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.

Consider making T5.TextTransform.Tool available as a .NET Core Global Tool (so it can be run like dotnet tt) without compromising the existing ability to use on .NET Core 2.0, especially as a per-project tool via <DotNetCliToolReference>.

atifaziz commented 6 years ago

Per NuGet/Home#6630, seems like the language for NU1212 is being clarified:

The requested package does not have the expected DotnetTool type and can't be used where that type is expected. For example, this package can't be used with "dotnet install tool -g"
atifaziz commented 6 years ago

Per dotnet/cli#9464, it appears that the only solution is to publish two separate packages as each package requires a distinct type. For the global tool version, a name other than T5.TextTransform.Tool will be needed, and ugly as it seems, I'm currently thinking T5.TextTransform.DotNetTool. 🤔 @0xced Do you have another suggestion?

0xced commented 6 years ago

How about dotnet-tt for the new global tool package? I saw @nil4 used dotnet-xdt for his Xml Document Transformation global tool.

Konard commented 5 years ago

dotnet-t4-project-tool is just so much better.

atifaziz commented 5 years ago

Closing in agreement with @Konard.