Dependency Management in .Net: Get

[Update: This article refers to a tool which will no longer be maintained. Until such time as NuGet is updated to naively support these capabilities, consider using the plug-in described here.]

In my last article, I demonstrated how my team is currently using NuGet.exe from our rake build to facilitate application-level, build-time retrieval of external dependencies.  Since not everyone uses rake for their build process, I decided to create a simple tool that could be consumed by any build process.

To see how the tool works, follow these steps:

Step 1: From the command line, execute the following:

$> nuget install Get

Step 2: Change directory to the Get tools folder.

Step 3: Create a plain text file named dependencies.config and add the following package references:

NHibernate   3.2.0.4000
Moq          4.0.10827

Step 4: Execute the following command:

$> get dependencies.config

The tool currently supports NuGet’s -Source, -ExcludeVersion, and -OutputDirectory switches.  From here, you just need to have it download to a central lib folder and adjust your project references as necessary.  Now stop checking in those assemblies! :)

About Derek Greer

Derek Greer is a consultant, aspiring software craftsman and agile enthusiast currently specializing in C# development on the .Net platform.
This entry was posted in Uncategorized and tagged . Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://twitter.com/codereflection Jeff Schumacher

    This already exists in the form of Chewie:
    http://nuget.org/List/Packages/Chewie

    • http://derekgreer.lostechies.com Derek Greer

      Yeah, there’s likely a few more solutions like this floating around out there.  I just took a look at it, but I find all the powershell stuff and the usage a bit off-putting.  To each his own I suppose.

      I did get this error when trying to run it from a ‘powershell’ shell though:

      PS C:TemptestProjChewie.0.0.5> .chewie.ps1The term ‘install-package’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.At line:1 char:16+ install-package <<<<  machine.specifications    + CategoryInfo          : ObjectNotFound: (install-package:String) [], CommandNotFoundException    + FullyQualifiedErrorId : CommandNotFoundException

      Not sure what's going on there, but the funny thing is that it executed fine when I ran it from my bash shell via 'powershell chewie.ps1'.  Perhaps I haven't flipped all the switches correctly to make powershell 'go' :)

  • http://twitter.com/codereflection Jeff Schumacher

    Nuget also has similar functionality… http://docs.nuget.org/docs/workflows/using-nuget-without-committing-packages

    Good to have variations though! :D

    • http://derekgreer.lostechies.com Derek Greer

      Yep, I took a look at this the other day.  Unfortunately, there seems to be some issues with it at the moment:  https://github.com/davidfowl/NuGetPowerTools/issues/8#issuecomment-2144527

      Issues aside, this only deals with updating, not with providing application-level dependency management.  It also takes the same approach as OpenWrap in that it modifies your project files to hook in its custom MSBuild files.  I prefer to keep things clean and separate.  Who knows, I might want to do something crazy one day like completely abandon MSBuild in favor of some Albacore csc.exe tasks.

      Bailey, you got that done yet? :)

    • http://derekgreer.lostechies.com Derek Greer

      Yep, I took a look at this the other day.  Unfortunately, there seems to be some issues with it at the moment:  https://github.com/davidfowl/NuGetPowerTools/issues/8#issuecomment-2144527

      Issues aside, this only deals with updating, not with providing application-level dependency management.  It also takes the same approach as OpenWrap in that it modifies your project files to hook in its custom MSBuild files.  I prefer to keep things clean and separate.  Who knows, I might want to do something crazy one day like completely abandon MSBuild in favor of some Albacore csc.exe tasks.

      Bailey, you got that done yet? :)

  • Pingback: The Morning Brew - Chris Alcock » The Morning Brew #942

  • http://kirestinfoster.webstarts.com/ AnikaBlair

    Recently, I did not give whole lot thought to commenting on weblog
    articles and have left feedback even less. Viewing your useful piece of
    writing, might inspire me to do this again.