# Nuget # * [[../|(UP)]] {{indexmenu>.#2|nsort tsort}} 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 [[Projects/XActLib/AD/Design/Assemblies/XAct.Data.Db.EF/]], which in turn will automatically ensure the download and installtion of the required *EntityFramework*, as well as [[Projects/XActLib/AD/Design/Assemblies/XAct.Data.Db/]], [[Projects/XActLib/AD/Design/Assemblies/XAct.Data/]] and [[Projects/XActLib/AD/Design/Assemblies/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. ** Searching for XAct Assemblies is easy as they all start with '*XAct.*' ### 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 to the bottom of the project **.csproj* file, that points to a folder in your solution directory that contains: #!xml $(SolutionDir).nuget $(NuGetToolsPath)\nuget.exe $(ProjectDir)packages.config ...etc... 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...[[Terminology|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 [[http/*nuget.codeplex.com/workitem/1779/]] The current consensus is: * Will work for first checkout from Source Control * After that...until the above is done: ** Remove the References ** Rename 'packages.config' to get it out of the way (eg: 'packages.config.txt') ** Nuget in the packages again (referencing the list in 'packages.config.txt' to ensure you get everything. ** Then Clean/Rebuild the assembly. ** Yes It's annoying, I don't have a better answer just yet, and I can't wait till they get this sorted out. ## TroubleShooting ## Common issues to watch out for: * The Team Lead forgot to prepare the Solution (right-click on the Solution, and Select Prepare for ... can't remember exactly what it says, but it adds to the solution the *.nuget* directory. * The Team Lead forgot to CheckIn the *.nuget*nuget.exe* -- a binary. Without doing that, devs who checkout the code can't run any scripts. ** A quickfix is to simply copy/paste the nuget.exe file from another Solution, and put it into the *.nuget* directory. * Strange things...Not all the nuget revision numbers seem to be updating when I use 'update-package' at the *Package Manager Console*... * Yeah. That's annoying. It's because *update-package* seems to not be ...imcomplete. At least Nuget 1.6's version of it. It seems to do a *mostly* good job...but fail to update *all* solutions. When downloading a new solution, or simply feel that things are acting wierd, I ensure that each assembly has the latest of each Reference, by invoking 'update-package' on every assembly in the solution. Annoying, but it doesn't really take that long either. Hopefully they'll fix it soon. 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 ## *[[http/*www.hanselman.com/blog/IntroducingNuGetPackageManagementForNETAnotherPieceOfTheWebStack.aspx/]] * [[http/*www.hanselman.com/blog/NuGetForTheEnterpriseNuGetInAContinuousIntegrationAutomatedBuildSystem.aspx/]]