Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget packages that are really exe commands?

Tags:

nuget

exe

I'm researching some of the Nuget stuff. I'm wondering if Nuget is appropriate for distributing .exe commands -- or for that matter if Nuget is only intended only to be used for references to a project (of course you could probably also link to an exe instead of a dll -- IIRC). Obviously, I can easily create a console app and then reference Nuget packages, but I'm wondering if this should always be necessary. Also, it seems that unlike gems, there isn't a local repo of gems, so I feel like .exe(s) are not the intended use for Nuget packages, but I don't see why they need to be limited in this fashion -- or am I missing something?

like image 459
lucidquiet Avatar asked Feb 29 '12 05:02

lucidquiet


People also ask

How do I know if NuGet exe is installed?

In Visual Studio, use the Help > About Microsoft Visual Studio command and look at the version displayed next to NuGet Package Manager. Alternatively, launch the Package Manager Console (Tools > NuGet Package Manager > Package Manager Console) and enter $host to see information about NuGet including the version.

What does NuGet exe do?

The NuGet ( nuget.exe ) CLI, provides the full extent of NuGet functionality to install, create, publish, and manage packages without making any changes to project files.

Where is NuGet exe stored?

The location of the default global packages folder. The default is %userprofile%\. nuget\packages (Windows) or ~/. nuget/packages (Mac/Linux).


1 Answers

You can include executable programs in you NuGet packages. From Creating and Publishing a Package:

tools - The tools folder of a package is for powershell scripts and programs accessible from the Package Manager Console. After the folder is copied to the target project, it is added to the `$env:Path (PATH) environment variable.

There are a few things you should be aware of, though, if you choose to do this:

  • You are correct that, unlike RubyGems, NuGet doesn't have the concept of system- or machine-level packages; packages are either targeted to a single project, or (more rarely) to a solution. So this executable will be placed in the package's folder for each solution in which it is used.
  • The NuGet Visual Studio extension adds the path of the package's tools folder to the PATH environment variable of its console, so you can conveniently execute the programs therein. Outside of Visual Studio, when using other NuGet clients (such as nuget.exe), there won't be any automatic PATH handling, so you'd have to handle getting a path to the program.
  • This NuGet feature is designed for scripts and executable programs that are somehow related to developing a project (e.g., code generators, tools that manipulate projects files, tools that compliment frameworks like emulators or development servers, etc.). While you can certainly use this feature in ways for which it wasn't designed, if you're looking to deliver system programs that aren't really related to project development, you might want to look at Chocolatey, "a Machine Package Manager, somewhat like apt-get, but built with windows in mind."
like image 59
half-ogre Avatar answered Sep 21 '22 15:09

half-ogre