Skip to content

Commit c209b12

Browse files
authored
Remove the dotnet global tool (#1572)
* remove the source code of the Tool * Update the how-to-run doc * remove the mentions of the tool from the docs * fix the CI build errors * removing projects manually from solution file was a bad idea
1 parent b4bda14 commit c209b12

File tree

12 files changed

+22
-493
lines changed

12 files changed

+22
-493
lines changed

BenchmarkDotNet.sln

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.Disassemble
3939
EndProject
4040
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.IntegrationTests.ManualRunning", "tests\BenchmarkDotNet.IntegrationTests.ManualRunning\BenchmarkDotNet.IntegrationTests.ManualRunning.csproj", "{9816D316-95C4-42E6-9E7B-A256C7E5D4BF}"
4141
EndProject
42-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.Tool", "src\BenchmarkDotNet.Tool\BenchmarkDotNet.Tool.csproj", "{1336CAFF-5321-495E-BAFA-AB4DC6BF791C}"
43-
EndProject
4442
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.IntegrationTests.Static", "tests\BenchmarkDotNet.IntegrationTests.Static\BenchmarkDotNet.IntegrationTests.Static.csproj", "{B4405781-40D3-42B8-B168-00E711FABA15}"
4543
EndProject
4644
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BenchmarkDotNet.Annotations", "src\BenchmarkDotNet.Annotations\BenchmarkDotNet.Annotations.csproj", "{D9F5065B-6190-431B-850C-117E3D64AB33}"
@@ -115,10 +113,6 @@ Global
115113
{9816D316-95C4-42E6-9E7B-A256C7E5D4BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
116114
{9816D316-95C4-42E6-9E7B-A256C7E5D4BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
117115
{9816D316-95C4-42E6-9E7B-A256C7E5D4BF}.Release|Any CPU.Build.0 = Release|Any CPU
118-
{1336CAFF-5321-495E-BAFA-AB4DC6BF791C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
119-
{1336CAFF-5321-495E-BAFA-AB4DC6BF791C}.Debug|Any CPU.Build.0 = Debug|Any CPU
120-
{1336CAFF-5321-495E-BAFA-AB4DC6BF791C}.Release|Any CPU.ActiveCfg = Release|Any CPU
121-
{1336CAFF-5321-495E-BAFA-AB4DC6BF791C}.Release|Any CPU.Build.0 = Release|Any CPU
122116
{B4405781-40D3-42B8-B168-00E711FABA15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
123117
{B4405781-40D3-42B8-B168-00E711FABA15}.Debug|Any CPU.Build.0 = Debug|Any CPU
124118
{B4405781-40D3-42B8-B168-00E711FABA15}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -151,7 +145,6 @@ Global
151145
{E5A0833C-B633-4D62-B645-A927CEBFEEBB} = {D6597E3A-6892-4A68-8E14-042FC941FDA2}
152146
{D189AAB3-46B4-4437-8E9C-72F021AB2B6E} = {D6597E3A-6892-4A68-8E14-042FC941FDA2}
153147
{9816D316-95C4-42E6-9E7B-A256C7E5D4BF} = {14195214-591A-45B7-851A-19D3BA2413F9}
154-
{1336CAFF-5321-495E-BAFA-AB4DC6BF791C} = {D6597E3A-6892-4A68-8E14-042FC941FDA2}
155148
{B4405781-40D3-42B8-B168-00E711FABA15} = {14195214-591A-45B7-851A-19D3BA2413F9}
156149
{D9F5065B-6190-431B-850C-117E3D64AB33} = {D6597E3A-6892-4A68-8E14-042FC941FDA2}
157150
{B620D10A-CD8E-4A34-8B27-FD6257E63AD0} = {63B94FD6-3F3D-4E04-9727-48E86AC4384C}

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,7 @@ ManualConfig.CreateEmpty() // A configuration for our benchmarks
151151

152152
If you prefer command-line experience, you can configure your benchmarks via
153153
the [console arguments](https://benchmarkdotnet.org/articles/guides/console-args.html)
154-
in any console application or use
155-
[.NET Core command-line tool](https://benchmarkdotnet.org/articles/guides/global-dotnet-tool.html)
156-
to run benchmarks from any dll:
157-
158-
```sh
159-
dotnet benchmark MyAssembly.dll --runtimes net472 netcoreapp2.1 Mono
160-
```
154+
in any console application (other types of applications are not supported).
161155

162156
### Automation
163157

build/build-and-pack.cmd

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ git clean -xfd
44
dotnet restore
55
dotnet build .\src\BenchmarkDotNet\BenchmarkDotNet.csproj -c Release
66
dotnet build .\src\BenchmarkDotNet.Diagnostics.Windows\BenchmarkDotNet.Diagnostics.Windows.csproj -c Release
7-
dotnet build .\src\BenchmarkDotNet.Tool\BenchmarkDotNet.Tool.csproj -c Release
87
dotnet build .\src\BenchmarkDotNet.Annotations\BenchmarkDotNet.Annotations.csproj -c Release
98
dotnet build .\templates\BenchmarkDotNet.Templates.csproj -c Release
109
dotnet pack .\src\BenchmarkDotNet\BenchmarkDotNet.csproj -c Release --include-symbols -p:SymbolPackageFormat=snupkg
1110
dotnet pack .\src\BenchmarkDotNet.Diagnostics.Windows\BenchmarkDotNet.Diagnostics.Windows.csproj -c Release --include-symbols -p:SymbolPackageFormat=snupkg
12-
dotnet pack .\src\BenchmarkDotNet.Tool\BenchmarkDotNet.Tool.csproj -c Release --include-symbols -p:SymbolPackageFormat=snupkg
1311
dotnet pack .\src\BenchmarkDotNet.Annotations\BenchmarkDotNet.Annotations.csproj -c Release --include-symbols -p:SymbolPackageFormat=snupkg
1412
dotnet pack .\templates\BenchmarkDotNet.Templates.csproj -c Release
1513
rmdir artifacts /s /q

docs/articles/guides/how-to-run.md

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,36 @@ uid: docs.how-to-run
44

55
# How to run your benchmarks
66

7-
There are several ways to run your benchmarks:
7+
There are several ways to run your benchmarks. What is important is that **BenchmarkDotNet works only with Console Apps**. It does not support any other kind of application like ASP.NET, Azure WebJobs, etc.
88

99
## Types
1010

11+
If you have just a few types with benchmarks, you can use `BenchmarkRunner`:
12+
1113
```cs
1214
var summary = BenchmarkRunner.Run<MyBenchmarkClass>();
1315
var summary = BenchmarkRunner.Run(typeof(MyBenchmarkClass));
1416
```
1517

16-
## Global dotnet tool
18+
The disadvantage of `BenchmarkRunner` is that it always runs all benchmarks in a given type (or assembly) and to change the type you need to modify the source code. But it's great for a quick start.
1719

18-
You can also run a benchmark using `BenchmarkDotNet.Tool`.
20+
## BenchmarkSwitcher
1921

20-
```log
21-
dotnet tool install -g BenchmarkDotNet.Tool
22+
If you have more types and you want to choose which benchmark to run (either by using console line arguments or console input) you should use `BenchmarkSwitcher`:
23+
24+
```cs
25+
static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
2226
```
2327

28+
Also you can use the config command style to specify some config from command line (more @docs.console-args):
29+
2430
```log
25-
dotnet benchmark MyAssemblyWithBenchmarks.dll --filter *
31+
dotnet run -c Release -- --job short --runtimes net461 netcoreapp21--filter *BenchmarkClass1*
2632
```
2733

34+
The most important thing about `BenchmarkSwitcher` is that you need to pass the `args` from `Main` to the `Run` method. If you don't, it won't parse the arguments.
35+
36+
2837
## Url
2938

3039
You can also run a benchmark directly from the internet:
@@ -34,24 +43,16 @@ string url = "<E.g. direct link to raw content of a gist>";
3443
var summary = BenchmarkRunner.RunUrl(url);
3544
```
3645

46+
**Note:** it works only for Full .NET Framework. It's not recommended to use this approach.
47+
3748
## Source
3849

3950
```cs
4051
string benchmarkSource = "public class MyBenchmarkClass { ...";
4152
var summary = BenchmarkRunner.RunSource(benchmarkSource);
4253
```
4354

44-
## BenchmarkSwitcher
45-
46-
Or you can create a set of benchmarks and choose one from command line:
47-
48-
```cs
49-
static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
50-
```
55+
**Note:** it works only for Full .NET Framework. It's not recommended to use this approach.
5156

52-
Also you can use the config command style to specify some config from command line (more @docs.console-args):
5357

54-
```log
55-
dotnet run -c Release -- --job short --runtimes clr core --filter *BenchmarkClass1*
56-
```
5758

docs/articles/guides/nuget.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ We have the following set of NuGet packages (you can install it directly from `n
1111

1212
* `BenchmarkDotNet`: Basic BenchmarkDotNet infrastructure and logic. This is all you need to run benchmarks.
1313
* `BenchmarkDotNet.Diagnostics.Windows`: an additional optional package that provides a set of Windows diagnosers.
14-
* `BenchmarkDotNet.Tool`: A dotnet tool to execute benchmarks built with BenchmarkDotNet.
1514
* `BenchmarkDotNet.Templates`: Templates for BenchmarkDotNet.
1615

16+
You might find other NuGet packages that start with `BenchmarkDotNet` name, but they are internal BDN packages that should not be installed manually. All that matters are the three packages mentioned above.
17+
1718
## Versioning system and feeds
1819
We have 3 kinds of versions: *stable*, *nightly*, and *develop*.
1920
You can get the current version from the source code via `BenchmarkDotNetInfo.FullVersion` and the full title via `BenchmarkDotNetInfo.FullTitle`.

docs/articles/guides/toc.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,5 @@
1616
href: console-args.md
1717
- name: Troubleshooting
1818
href: troubleshooting.md
19-
- name: Command-line tool
20-
href: tool.md
2119
- name: BenchmarkDotNet templates
2220
href: dotnet-new-templates.md

0 commit comments

Comments
 (0)