Buenas,
Today the friend Juan has written a post where he presents a little to NuGet. As it leaves the ball in the air and also provides a little to one conversation we had with @ EduDelPozo, today plays a little talk about how to work with NuGet and Team Foundation Server.
First things first, in my case assume a directory structure where we separate on the one hand the source code in the SRC folder and then shared libraries in the LIB folder.
In the picture above we can see in this project there are 2 class libraries. To further complicate the scenario we are going to add a couple of references of Enterprise Library from NuGet. In this case logging from http://nuget.org/packages/EnterpriseLibrary.Logging.
Once installed we have our dlls added as a reference and the package.config file has been added in the project.
1: Each package is licensed to you by its owner. Microsoft is not responsible for,
2: nor does it grant any licenses to, third-party packages. Some packages may
3: include dependencies which are governed by additional licenses. Follow the
4: package source (feed) URL to determine any dependencies.
5:
6: Package Manager Console Host Version 1.8.30524.9000
7:
8: Type 'get-help NuGet' to see all available NuGet commands.
9:
10: PM>; Install-Package EnterpriseLibrary.Logging
11: Attempting to resolve dependency 'EnterpriseLibrary.Common (≥ 5.0)'.
12: Attempting to resolve dependency 'Unity.Interception (≥ 2.1)'.
13: Attempting to resolve dependency 'Unity (≥ 2.1)'.
14: Attempting to resolve dependency 'CommonServiceLocator (≥ 1.0)'.
15: Successfully installed 'CommonServiceLocator 1.0'.
16: You are downloading Unity from Microsoft patterns &; practices, the license
17: agreement to which is available at http://www.opensource.org/licenses/ms-pl.
18: Check the package for additional dependencies, which may come with their own
19: license agreement(s). Your use of the package and dependencies constitutes
20: your acceptance of their license agreements. If you do not accept the
21: license agreement(s), then delete the relevant components from your device.
Now, in our case we had defined the external references should go to the LIB folder. As NuGet is intelligent, but not so much, we have to tell you that you need to change the behavior by default. It consists in letting the assembled in a packages folder, for example
[…\NuGet\src\ClassLibrary2\packages\EnterpriseLibrary.Common.5.0.505.0\lib\NET35\Microsoft.Practices.EnterpriseLibrary.Common.dll]
Well, to change this functionality we selected the solution, deploy the contextual menu and select the [Enable NuGet Package Restore] option
This action add us a new solution folder called .nuget and within the same executable NuGet and an MSBuild file with different targets for the download of packages added.
If we are going to the directory we will see that it also creates a file called NuGet.Config. But for our example it will not this configuration file which defines the directory to download the packages. What we do will be the following:
1 Add a file called nuget.config in the directory of the solution
2 Within the same defined the path to download the packages with the following code
do do <? xml version = "1.0" encoding = "utf-8"? >
< settings >
< repositoryPath >…\..\..\Lib < /repositoryPath >
< /settings >
3 Donate!
If we see the lib folder, we will see that we have packages with which we are working within the same
Ahh and thanks to the @ Edudelpozo that I gave a hand with this last part ![]()
Saludos @ Home
El Bruno
Leave a reply to my site Cancel reply