TeleConsole Client is available on NuGet!
(Above: Some cool-looking circuits that feature on the NuGet website)
Hey! After a large amount of research, I've finally figured out how to create a simple NuGet package. Since I ended up using TeleConsole in a recent ACW and it doesn't have any dependencies (making packaging easier!), I decided to use it to test the system.
I think it's turned out rather well actually - you can find it on NuGet here.
Since it's been such a complicated process, rather than talking about TeleConsole itself, I'd like to give a sort-of tutorial on how I did it instead (if you'd like to read more about TeleConsole, I posted about it when I first released it here).
To start with, you'll need to install NuGet. Once done, the next step is to create a
.nuspec file for your project. It goes in the same directory as the
.csproj file for the project you want to publish on NuGet. I haven't yet figured out how to reference another project in the same solution and have it work with NuGet, but I should imagine it's mostly automatic. Here's the
.nuspec file for TeleConsole:
<?xml version="1.0"?> <package> <metadata> <id>TeleConsoleClient</id> <version>0.3</version> <title>$title$</title> <authors>Starbeamrainbowlabs</authors> <owners>Starbeamrainbowlabs</owners> <licenseUrl>https://github.com/sbrl/TeleConsole/blob/master/LICENSE</licenseUrl> <projectUrl>https://github.com/sbrl/TeleConsole/</projectUrl> <iconUrl>https://github.com/sbrl/TeleConsole/blob/master/logo.png?raw=true</iconUrl> <requireLicenseAcceptance>false</requireLicenseAcceptance> <description>$description$</description> <releaseNotes>Initial nuget release.</releaseNotes> <copyright>Copyright 2017</copyright> <tags>Debugging Networking Console Remote</tags> </metadata> </package>
As you can see, it's actually a fairly simple format - based on XML of course, since C♯ seems to love it for some reason. The bits in
$ signs are special - they are references to the corresponding values in the
.csproj file. You can do it for
<version> too - but I was experiencing issues with it not picking this up correctly, so I'm specifying it manually. More information about this can be found on the Microsoft website - links are available at the bottom of this post.
With that done, the next step is to package it into a
`.nupkg file 0 which is basically just a renamed
.zip file with a specific structure. The
nuget command-line application has the ability to do this for us - but doesn't work on Linux without an extra argument (thanks to @ArtOfSettling on GitHub for discovering this!):
nuget pack -MsbuildPath /usr/lib/mono/msbuild/15.0/bin/
...Windows users don't need to include the
-MsbuildPath /usr/lib/mono/msbuild/15.0/bin/ bit. This command will output a
.nupkg file, which you can then upload to nuget.org here, once you're signed in.