@@ -38,105 +38,43 @@ Create your own wrapped tool by following the [Usage](#usage) section below.
3838
3939## Usage
4040
41- To create a DotNet tool for an existing application :
41+ To create a .NET tool using DotnetToolWrapper, you'll need to :
4242
43- 1 . Create a .nuspec file for the Dotnet tool
44- 2 . Create a ` tools/net8.0/any/DotnetToolSettings.xml ` file which points to this DotnetToolWrapper
45- 3 . Create a ` tools/net8.0/any/DotnetToolWrapper.json ` file describing the existing application to run
46- 4 . Copy this DotnetToolWrapper application (.dll) into the ` tools/net8.0/any ` folder
47- 5 . Add the existing application files under the ` tools/net8.0/any ` folder.
48- 6 . Package the NuGet package
43+ 1 . Create a .nuspec file for the .NET tool package
44+ 2 . Create configuration files (DotnetToolSettings.xml and DotnetToolWrapper.json)
45+ 3 . Copy DotnetToolWrapper files and your native executables
46+ 4 . Package as a NuGet package
4947
50- ## Folder Structure
48+ For complete step-by-step instructions, detailed examples, and troubleshooting, see the [ Usage Guide ] ( docs/usage.md ) .
5149
52- The following is an example folder structure for a tool:
50+ ## Quick Example
51+
52+ Here's a minimal folder structure:
5353
5454``` text
5555root
56- |- tool.nuspec Nuspec file
57- |- README.md README file
56+ |- tool.nuspec
5857|- tools
59- |- net8.0
60- |- any
61- |- DotnetToolSettings.xml Dotnet tool settings
62- |- DotnetToolWrapper.json DotnetToolWrapper application settings
63- |- DemaConsulting.DotnetToolWrapper.deps.json DotnetToolWrapper dependencies
64- |- DemaConsulting.DotnetToolWrapper.dll DotnetToolWrapper application
65- |- DemaConsulting.DotnetToolWrapper.runtimeconfig.json DotnetToolWrapper runtime
66- ```
67-
68- ## Nuspec File
69-
70- The following is a sample .nuspec file for a tool:
71-
72- ``` xml
73- <?xml version =" 1.0" encoding =" utf-8" ?>
74- <package xmlns =" http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd" >
75- <metadata >
76- <id >My.Tool.Package</id >
77- <version >0.0.0</version >
78- <title >Title of Tool</title >
79- <authors >Author Name</authors >
80- <license type =" expression" >MIT</license >
81- <readme >docs/README.md</readme >
82- <description >Description of Tool</description >
83- <packageTypes >
84- <packageType name =" DotnetTool" />
85- </packageTypes >
86- </metadata >
87- <files >
88- <file src =" README.md" target =" docs/README.md" />
89- <file src =" tools/**/*" target =" tools" />
90- </files >
91- </package >
92- ```
93-
94- Refer to the [ .nuspec File Reference] ( https://learn.microsoft.com/en-us/nuget/reference/nuspec ) for more details.
95-
96- ## DotnetToolSettings.xml
97-
98- The following is a sample DotnetToolSettings.xml file:
99-
100- ``` xml
101- <?xml version =" 1.0" encoding =" utf-8" ?>
102- <DotNetCliTool Version =" 1" >
103- <Commands >
104- <Command Name =" my-tool" EntryPoint =" DemaConsulting.DotnetToolWrapper.dll" Runner =" dotnet" />
105- </Commands >
106- </DotNetCliTool >
107- ```
108-
109- The ` Name ` should be customized to match the desired name of the Dotnet tool. Dotnet uses this information
110- when installing the package.
111-
112- ## DotnetToolWrapper.json
113-
114- The following is a sample DotnetToolWrapper.json file indicating the program to execute for each supported target:
115-
116- ``` json
117- {
118- "win-x64" : {
119- "program" : " win-x64/my-program.exe"
120- },
121- "linux-x64" : {
122- "program" : " linux-x64/my-program"
123- }
124- }
58+ |- net8.0/any
59+ |- net9.0/any
60+ |- net10.0/any
61+ |- DotnetToolSettings.xml
62+ |- DotnetToolWrapper.json
63+ |- DemaConsulting.DotnetToolWrapper.dll
64+ |- (other wrapper files)
65+ |- win-x64/my-tool.exe
66+ |- linux-x64/my-tool
67+ |- osx-arm64/my-tool
12568```
12669
127- The target strings consist of the operating system and architecture. Supported operating systems are ` win ` ,
128- ` linux ` , ` freebsd ` , and ` osx ` . Supported architectures are ` x86 ` , ` x64 ` , ` arm ` , ` arm64 ` , ` wasm ` , and ` s390x ` .
129-
130- ## Packaging
131-
132- To create the Dotnet tool NuGet package:
70+ Package and install:
13371
13472``` bash
135- nuget pack -Version < x.y.z>
73+ nuget pack tool.nuspec -Version 1.0.0
74+ dotnet tool install -g My.Tool.Package
75+ my-tool --help
13676```
13777
138- Replace ` <x.y.z> ` with your desired version number.
139-
14078## How It Works
14179
142801 . User installs your .NET tool package via ` dotnet tool install `
@@ -218,9 +156,3 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
218156- ** Issues** : Report bugs or request features via [ GitHub Issues] ( https://github.com/demaconsulting/DotnetToolWrapper/issues )
219157- ** Discussions** : Ask questions via [ GitHub Discussions] ( https://github.com/demaconsulting/DotnetToolWrapper/discussions )
220158- ** Security** : Report vulnerabilities per [ SECURITY.md] ( SECURITY.md )
221-
222- ## Acknowledgments
223-
224- - Built with [ .NET] ( https://dotnet.microsoft.com/ )
225- - Distributed via [ NuGet] ( https://www.nuget.org/ )
226- - CI/CD powered by [ GitHub Actions] ( https://github.com/features/actions )
0 commit comments