Archive

Posts Tagged ‘SCM’

Golden NuGet!

March 29, 2011 1 comment

For anyone using VS2010, one tool you need to try out is NuGet (actually pronounced new-get according to Microsoft, but what do they know?!).

What is it?

NuGet is Microsoft’s answer to the much-lamented gap in the .Net space for a package management tool like Ruby’s Gems or Linux’s RPM.

NuGet simply looks after the download and installation of tools and libraries you use in your projects.  It will get the appropriate version of all needed DLLs, configuration files, and related tools, put them in a folder, and do any configuration if needed.  Simple!  Also useful is the fact that it will download any dependencies – so for example if we want to install Shouldly, which uses Rhino Mocks, NuGet will get the appropriate version of that as well.

And that’s about it.  So it won’t change your world, but it will save you a good few hours each year hunting for, downloading, and installing tools.

History

NuGet started out as NuPack, which kind of took over from the Nu open source project.  Indeed, NuGet is itself open source, continuing Microsoft’s trend of a more transparent and community-involving future, which is nice.

There are other package managers for .Net, including:

However, as usual, things don’t tend to take off in the .Net community until Microsoft makes their version, which then becomes king. I haven’t tried any of those package managers, but I wouldn’t want to bet on them being too successful now NuGet’s out.

Anyway, enough of the history lesson, how do I use this thing?!

Installation

Firstly, you need to get it installed, which is simple as it’s in the Visual Studio Extension Manager (Tools -> Extension Manager).  Search the Online Gallery for ‘NuGet’ and you should find it:

VS2010 Extension Manager Screenshot

VS2010 Extension Manager

A couple of clicks later and you’re ready to go!

Putting it to Use

There are two interfaces.  You can either right-click on a project and select ‘Add Library Reference’, and find what you need with a handy visual interface (the same as the Extension Manager):

NuGet Visual Interface screenshot

NuGet Visual Interface

Or, by selecting Tools -> Library Package Manager -> Package Manager Console,  you can use the Powershell-based console version, like a real developer!

NuGet console screenshot

NuGet Console

(Check out some NuGet Console Commands, if that’s how you want to roll.)

Either way, you’ll end up with a new ‘packages’ folder in your solution, containing the bits you need (as well as having references automatically added to your project, and configuration set):

Packages Folder screenshot

Packages Folder

Et voilá!  You’re ready to log/unit test/mock/whatever to your heart’s content.

You can also delete packages, update packages, and so on – it’s all pretty straightforward, so I’ll leave you to work that out.

So what are you waiting for?  Go and nu-get it now!!  (sorry..)

Advertisements
Categories: Tools Tags: ,

Personal Source Control with Google Code & SVN

August 26, 2009 Leave a comment

I’m reading The Pragmatic Programmer at the moment, and one thing they recommend is to always use source control, even for small prototypes and personal projects.  Now I’ve been using source control at work ever since I started coding, but I’ve never given serious thought to using it at home – I only have a single machine for a start.

But that’s not really an issue these days, as there are a number of Internet hosts that can act as your source control server – and this gives the additional advantage of being able to access your code wherever you can get on the ‘net.  And as well as being a good way of backing things up,  you also get a full revision history, which can be handy when things go pear-shaped!

Now, I don’t want to spend any actual money on this, but that’s not a problem as there are many open source options available – I didn’t look too hard here as I’ve already used Subversion (SVN) at a previous job and it has a big following, and is supported by most of the online hosts.  Same with the client, which is the part I had to install on my machine – TortoiseSVN integrates with Windows Explorer, is free, easy to use, and has all the functionality you’d expect.

TortoiseSVN in action

TortoiseSVN in action

So the main thing to do was chose a host.  Again, there are many free options – this site has an excellent comparison of the available options, including several free ones.  One of the main things you need to decide is whether you want your code to be open source or not, as several of them only host open source projects.  I’m happy enough with that, so after a little research online I went for Google Code, which has a lot of space, unlimited users, and some useful features.  Two minutes to create a Google account, then you can crate a new project by entering a few basic details, and you’re ready to rock & roll!

Creating a new project in Google Code

Creating a new project in Google Code

Once you’ve got TortoiseSVN installed and your Google Code project set up, you just need to upload your project – this blog has some useful tips that will get you up and running in a couple of minutes.  And that’s it!  In less than 10 minutes you can be up and running with a full source control solution, including online administration:

Google Code administration page

Google Code administration page

And if you want to get someone fixing your defects for you, all they need is an SVN client and you’ve got yourself a development team.  If I’d known it was that easy, I’d have done it years ago..