Add these three (indented) lines to your csproj file
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<PackAsTool>true</PackAsTool>
<ToolCommandName>gtconfig</ToolCommandName>
<PackageOutputPath>./nupkg</PackageOutputPath>
</PropertyGroup>
After successful build run
dotnet pack
This will build the package in the output path set in <PackageOutputPath>
The last step is to install this package
dotnet tool install --global --add-source ./nupkg GtConfig
Since we are installing from a local package we must include the --add-source command with the package location as the argument along with the final argument which is the namespace of the project.
Nick Chapsas has a fantastic video on YouTube on this: https://www.youtube.com/watch?v=JNDgcBDZPkU