Table of Contents

Nuget

Summary

You really can't get much out of XActLib without first installing Nuget in order to use for the installation heavy lifting.

What is Nuget? NuGet is a free, open source developer focused package management system for the .NET platform intent on simplifying the process of incorporating third party libraries into a .NET application during development.

The advantages it brings are:

  • Let's developers concentrate on their code,
  • Use a myriad of open source libraries
  • Packages that depend on other packages, download the dependencies recursively, saving a lot of time.
  • Some packages even take care of initial installation and config file changes, easing the learning curve immensely.

XActLib – being a loosely couple library of Assemblies – uses Nuget exclusively to transparently install assemblies recursively. An example might be using Nuget to install and Reference XAct.Data.Db.EF, which in turn will automatically ensure the download and installtion of the required EntityFramework, as well as XAct.Data.Db, XAct.Data and XAct.Core. All in less than 30 seconds, thereabouts. That's why we use Nuget: less friction.

Installation

Download Nuget from nuget.org. It will take you to the Visual Studio Tools site. Note – you won't see anything change until you restart Visual Studio.

Usage

Adding packages to you Projects

Using Nuget to install Extensions is extremely easy: * In Visual Studio, * Right click a project, and select Manage Nuget Packages… * Select Nuget official package source * THen type the name of an assembly to add to your project.

Unpacking a project from Source Control

Then again, adding assemblies to a Solution is usually done by a Team Lead – whereas most of the time, developers need to concentrate on joining a team, and getting up to speed quickly. This means checking out code – that does not References to DLL's that were not source controlled, and are meant to be 'rehydrated' into your project.

Since Nuget 1.6, the rehydration step is backed into a Project's file by Nuget (the Team Lead has to 'prepare' the solution, but that step is trivial), by adding

#!xml
  <Import Project="$(SolutionDir)\.nuget\nuget.targets" />

to the bottom of the project .csproj* file, that points to a folder in your solution directory that contains: <sxh csharp> #!xml <NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath> <NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath> <PackagesConfig>$(ProjectDir)packages.config</PackagesConfig> …etc… </sxh> Which it can then invoke to check and download assemblies. You get the point (ie, I don't want to go into the nitty gritty here…JFGI. ### Refreshing Assemblies ### Much as I like NuGet, there are still some problems with it, as of version 1.7.
Currently…you can't. This may change in the future. Keep an eye on this issue 1779 The current consensus is: * Will work for first checkout from Source Control * After that…until the above is done:
Remove the References

TroubleShooting

Common issues to watch out for:

update package -project XAct.Examples.SomeApp.Hosts.UnitTests
...
update package -project XAct.Examples.SomeApp.Hosts.Application
...
update package -project XAct.Examples.SomeApp.Hosts.Infrastructure.IoC
...
update package -project XAct.Examples.SomeApp.Hosts.Infrastructure.IoC.K2
...
update package -project XAct.Examples.SomeApp.Hosts.Infrastructure.IoC.UT
...
update package -project XAct.Examples.SomeApp.Hosts.Infrastructure.Services
...

Resources

IntroducingNuGetPackageManagementForNETAnotherPieceOfTheWebStack.aspx NuGetForTheEnterpriseNuGetInAContinuousIntegrationAutomatedBuildSystem.aspx