dotnet pack for global tools support for Full framework
See original GitHub issueMy idea is to have both global tool, and regular application, so non developers could be targeted with app running full framework
Steps to reproduce
- Create global tool, and add support for multiple target frameworks
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackAsTool>true</PackAsTool>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.1;net462</TargetFrameworks>
</PropertyGroup>
</Project>
- run
dotnet pack
Expected behavior
Generate pack only for netcoreapp2.1
or provide ability to select which TFM target
Actual behavior
C:\Program Files\dotnet\sdk\2.1.300-rc1-008673\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.PackTool.targets(42,5): error : only supports .NET Core. [XXX.csproj]
Environment data
dotnet --info
output:
Пакет SDK для .NET Core (отражающий любой global.json): Version: 2.1.300-rc1-008673 Commit: f5e3ddbe73
Host (useful for support): Version: 2.1.0-rc1 Commit: eb9bc92051
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (1 by maintainers)
Top Results From Across the Web
dotnet pack command - .NET CLI
The dotnet pack command builds the project and creates NuGet packages. The result of this command is a NuGet package (that is, a...
Read more >NET tools - .NET CLI
Covers global tools, tool-path tools, and local tools. ... A .NET tool is a special NuGet package that contains a console application.
Read more >Tutorial: Install and use a .NET global tool - .NET CLI
Complete the first tutorial of this series. Use the tool as a global tool. Install the tool from the package by running the...
Read more >Tutorial: Create a .NET tool using the .NET CLI
In this tutorial, you create and package a tool. In the next two tutorials you use the tool as a global tool and...
Read more >dotnet tool install command - .NET CLI
The dotnet tool install command installs the specified .NET tool on your machine.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Found a way to put it all in one csproj:
The resulting nupkg:
<packageType name="DotnetTool" />
.tools\netcoreapp2.1\any
directory with files in it.lib
directory.<group targetFramework=".NETFramework4.0" />
.dotnet tool install
and run.I faced the same problem and I did the following workaround solution:
To avoid creation of shared project:
The console application is multi-target
(net45;netappcore2.1)
ASIS, no PackAsToolCreate new project for the global tool (MyGlobalTool.csproj) :
netappcore2.1
withPackAsTool = true
Add reference toMyConsole
project applicationin netcoreapp MyGlobalTool project, create a class with Main method that call
MyConsole.Main()
The advantage of this solution: