Manage dependencies, how?

Oct 20, 2010 at 11:09 PM

Hi,

Here is the scenario:

1. We use TFS for source controller.
2. We've solutions with multiple projects.
3. Each project depends on some dependency (another dll or third party dll) 
4. We don't want those dependencies are stored in the same solution in TFS.

5. What we are looking at:
    5.1 Store all dependencies (dlls) to shared location or TFS
    5.2 One Nupack file that list all [dependencies with location(where to get that dependency)] and store that NuPack file to the solution (TFS)
    5.2 By clicking on the NuPack file, it'll download all dependencies to "Lib" or "Packages" folder. 
         All projects reference dependency from "Lib" or "Packages" folder only.

Can NuPack help in this scenario?

Please advice.
Thanks.

 

Coordinator
Oct 20, 2010 at 11:26 PM

Keep in mind that NuPack works at the package level and not at the assembly level. A single package could contain one assembly or multiple assemblies. So it's important to make that distinction.

It's not clear to me exactly what you're trying to accomplish. Perhaps if you could clarify the scenario a bit to help us understand what it is you're trying to do.

Oct 20, 2010 at 11:30 PM

Can NuPack works like "IVY"?

 

Coordinator
Oct 20, 2010 at 11:31 PM

I'm not familiar with IVY, so I don't know.

Oct 20, 2010 at 11:55 PM

Ok.

Let me try to explain my scenario again:

1. We've solution contains multiple projects, stored on TFS
2. We use dependency dll like NInject, Elmah, etc
3. Multiple projects in that solutions using these dependencies

What we want:
1. We want one location "Library" for solution that has all dependencies
2. "Library" folder should be up to date and get latest from TFS or shared location via NuPack file

This applies to all devs using the same solutions.
This way, we can manage all dll in one place on TFS or shared location and get latest to individual dev via running NuPack file.

Is this possible?

 

Coordinator
Oct 21, 2010 at 12:01 AM

If I understand correctly, yes this is possible. It’s how NuPack works for the most part.

Oct 21, 2010 at 12:09 AM

Thanks.

Will you please point to the right direction how can i achieve that?

1. How to create nuspec file?
2. Format of nuspec file?
3. How to run that file?

Sorry for basic questions, but i can't find the answers online.

Coordinator
Oct 21, 2010 at 12:14 AM

Sure! Just click on the Documentation tab in our project and there’s documentation on all of these things.

Oct 21, 2010 at 1:16 AM

i've hard time feagure out following stuff:
Can someone please help?

1. Format of nuspec file:

<?xml version="1.0" encoding="utf-8"?>
<package>
  <metadata>
    <id>sample</id>
    <version>1.0.0</version>
    <authors>
      <author>Microsoft</author>
    </authors>
  </metadata>
  <dependencies>
      <dependency id="elmah" version="3.0.0" />
      <dependency id="ninject" minversion="2.1.0" />
  </dependencies> 
  <files src="c:\docs\bin\*.xml" target="lib" />
  <files src="bin\Debug\*.dll" target="lib" />
  <files src="bin\Debug\*.pdb" target="lib" />
  <files src="tools\**\*.*" />
</package>

How the file node will be useful?
How can i specify the locations of dependency:
From where to get dependency and where to keep in local? What i mean is:

<dependencies>
      <dependency id="elmah" version="3.0.0" from="\\shared\dependencies\elmah" to="..\Lib\" />
     

2. Once i create nuspec file, how to run that file?

 

Developer
Oct 21, 2010 at 2:57 AM
Edited Oct 21, 2010 at 3:07 AM

* Dependencies are other packages that your package depends on. When NuPack attempts to install your package, it would search for packages in the repository that match your dependency requirements. In this case, NuPack would expect to find the elmah and ninject packages to be present in the repository you are installing the "sample" package from. When specifying your package source, point to the file share where elmah and ninject are located. e.g. (\\shared\dependencies).

* Files are what go in your package.

* Use the New-Package cmdlet( http://nupack.codeplex.com/documentation?title=Package+Manager+Console+Command+Reference ) or the NuPack Console that you can download from http://nupack.codeplex.com/releases/view/52016. NuPack.exe <nuspec file> would build the nupkg for you.

 

 

Oct 21, 2010 at 3:53 AM

I may be missing something, but I think you're doing something completely unnecessary. Why re-pack elmah which is *already* a nupack???

In your solution, simply add the packages you want, then checkin to source control the packages folder that is automatically created for you by nupack alongside the solution file.

And you are *done*!

from android nexus1

On Oct 20, 2010 9:16 PM, "greatc" <notifications@codeplex.com> wrote:
> From: greatc
>
> i've hard time feagure out following stuff:
> Can someone please help?1. Format of nuspec file:<?xml version="1.0" encoding="utf-8"?>
> <package>
> <metadata>
> <id>sample</id>
> <version>1.0.0</version>
> <authors>
> <author>Microsoft</author>
> </authors>
> </metadata>
> <dependencies>
> <dependency id="elmah" version="3.0.0" />
> <dependency id="ninject" minversion="2.1.0" />
> </dependencies>
> <files src="c:\docs\bin\*.xml" target="lib" />
> <files src="bin\Debug\*.dll" target="lib" />
> <files src="bin\Debug\*.pdb" target="lib" />
> <files src="tools\**\*.*" />
> </package>How the file node will be useful?
> How can i specify the locations of dependency:
> From where to get dependency and where to keep in local? What i mean is:<dependencies>
> <dependency id="elmah" version="3.0.0" from="\\shared\dependencies\elmah" to="..\Lib\" />
> 2. Once i create nuspec file, how to run that file?
>
>
Oct 21, 2010 at 4:35 AM

If we are checking in the shared folder Packages (that has all dll) to same solution, why even i need NuPack?

I can put all my dll to some shared folder and check in that folder to TFS. And reference to that folder from all projects.

How NuPack helps me?

Developer
Oct 21, 2010 at 4:40 AM

You can update those packages with nupack.

Oct 21, 2010 at 4:50 AM

@dfowler:

Update those package means?

will u please elaborate?

i m trying to understand the NuPack.

Oct 21, 2010 at 5:20 AM

Here what i did:

1. Create MVC project
2. Add "NInject" from "Add Package Reference"
3. It does following 3 things:
    3.1 Add package.config file
    3.2 Add NInject dll reference
    3.3 Add "packages" folder at application root level
4. Now, if this is TFS solution, what should i check in?

 

Oct 21, 2010 at 5:56 AM

@pranavkm

1. How do we specify package source? Do you mean file source (src)?
2. Should my nuspec looks like this:

<?xml version="1.0" encoding="utf-8"?>
<package>
  <metadata>
    <id>My Solution</id>
    <version>1.0.0</version>
    <authors>
      <author>Blah</author>
    </authors>
  </metadata>
  <dependencies>
      <dependency id="elmah" version="3.0.0" />
      <dependency id="ninject" minversion="2.1.0" />
  </dependencies>
</package>

3. Once i create Nuspec file, should i need to generate NuPack project using NuPack.exe?
4. After i create NuPack project, should i check in that project?
5. Once i check in to TFS, how others will get "My Solution" package, it's dependent packages and all dlls?

 

Developer
Oct 21, 2010 at 8:09 AM

Yes, you're on the right track. Unfortunately you managed to two hit two issues that we are currently working on:-

* Meta-packages (packages that are only made of dependencies) are broken in the current release and we're working on fixing it -  Bug # http://nupack.codeplex.com/workitem/180. A simple workaround until we fix this is to have at least one "file" in your package.

* Going back to your question, yes. Once you have the nuspec file, run the nupack.exe and you will get a nupkg file. Now here's where we hit the second issue. The packages that you mention are already available in the temporary feed we host and as a part of our installation we should say, looks like my current feed does not have the dependencies you asked for, let me go look up all the other feeds that you've specified. Sadly it doesn't. So, a workaround (until we fix it) would be to download all your dependencies to your disk, put the My-Solution.nupkg in the same folder as the other nupkg files, add the folder to your Package Source (Tools --> Options --> Package Manager) and install from this source.

NuPack would install the packages for you, copy the dependencies and My-Solution.nupkg to the Packages folder under your solution and it's TFS ready. By the next release, we will have both the issues resolved, so all you would need is to place the My-Solution.nupkg somewhere on disk, point a Package Source to that folder and install the package. NuPack would look for the right (or the latest) copies for your dependencies on all the other feeds you've listed and install/update them as necessary.

* The packages get checked in with the rest of your code, so everybody else using your source control would get the assemblies and files.

Oct 21, 2010 at 4:05 PM

I struggle with the same problem.

My case:

We are a team of developers working on a web application for a client. We use several open source packages. For NuPack to bee interesting for a team working on a project like this it will have to manage the dependencies.

If I add a package via NUPack on my computer, what happens when my colleagues check out the code?

Will they have to manually install the package I added?

 

Oct 21, 2010 at 5:13 PM

@pranavkm,

Thanks.

So here what i did.

1. Created simple class library (ClassLibrary1.dll) with version 1.0.0.0 and Target Framework: .Net Framework 4
2. Created the following "myPackage.nuspec" file
<?xml version="1.0" encoding="utf-8"?>
<package>
  <metadata>
    <id>ClassLibrary1 package</id>
    <version>1.0.0</version>
    <authors>
      <author>Chintan</author>
    </authors>
    <description>ClassLibrary1 is test dll</description>
    <language>en-US</language>
  </metadata>
  <files src="bin\Debug\ClassLibrary1.dll" target="lib" />
</package>
3. Then i've created "ClassLibrary1 package.1.0.0.nupkg" using NuPack.exe and passing "myPackage.nuspec" file
4. It created nupkg successfully.
5. I put "ClassLibrary1 package.1.0.0.nupkg" to shared location, let's say \\shared\dependency
6. Then change my Package Source (Tools --> Options --> Package Manager) to \\shared\dependency
7. Righ click the References and click "Add Package Referennce...", it shows my "ClassLibrary1 package.1.0.0.nupkg"
8. When i click "Install" it gives me following error:

" Unable to find assembly references that are compatible with the target framework '.Net Framework, version=v4.0'

Please advice ASAP.

 

Oct 21, 2010 at 5:47 PM

Just found out one interesting stuff:

<files src="bin\Debug\ClassLibrary1.dll" target="lib" />

So on previous thread, i said on point 8.: "Install" failed.
I've checked the "Packages" folder for that solution and i found out that it installed "ClassLibrary1 package.1.0.0" folder and under that "lib" and "ClassLibrary1 package.1.0.0.nupkg"

But the strange thing is, it downloaded "ClassLibrary1.dll" under "lib\bin\Debug\" folder.
is that the reason to get " Unable to find assembly references that are compatible with the target framework '.Net Framework, version=v4.0' error?

How NuPack.exe puts the ClassLibrary1.dll under "lib\bin\Debug\" folder?

Oct 21, 2010 at 6:03 PM
Edited Oct 21, 2010 at 6:12 PM

Even if put the following way:
  <files src="C:\Users\greatc\Desktop\c\Projects\Console\ClassLibrary1\dlls\ClassLibrary1.dll" target="lib" />
It put under "lib\dlls\" folder.

But if i kept as follows:
  <files src="C:\Users\greatc\Desktop\c\Projects\Console\ClassLibrary1\ClassLibrary1.dll" target="lib" />
it put under "lib" folder and installed correctly.

What's the criteria to get dll from?

Please advice.

Oct 21, 2010 at 10:13 PM
Edited Oct 21, 2010 at 10:14 PM
greatc wrote:

Can NuPack works like "IVY"?

 

NuPack does not work like Apache Ivy.  It appears that it might head in that direction in the future and/or possibly serve as a foundation for a system like Ivy or Maven.