16

We use NuGet to manage our third party packages.

We also have to build both an x86 and x64 builds.

We now have a dependency on a NuGet package (zeromq) that depends on a C dll and therefore has an x86 and x64 releases.

When searching in Nuget I only see two distinct projects (zeromq x64 and zeromq x86) and not one unified project.

Constraint

Our build process on the developers machines is to select the appropriate configuration(ie Debug/x86, Release x64, etc) in visual studio and build so any solution we use would have to fit into the visual studio GUI( ie MSBuild soltuions wouldn't' really fit our current workflow).

EDIT

Addendum to the constraint....If we can't do this automatically within NuGet, is there a way to do this with some sort of powershell prebuild script? ie if we know we are building the x86 build is there a way to hook NuGet so that it uses the x86 packaes instead of the x64 packages?

What is the proper way to manage NuGet Packages like this??

chollida
  • 7,834
  • 11
  • 55
  • 85
  • 1
    You may want to look over [this answer](http://stackoverflow.com/a/11376762/80274) it may give you some inspiration for a conditional pre-build script. – Scott Chamberlain Aug 26 '13 at 15:08

2 Answers2

5

Then you have two approaches,

  • Create your own ZeroMQ fork and follow System.Data.SQLite.org to implement Native Library Pre-loading. Then you can create a single NuGet package instead of two.

  • Create two projects for your executable (the same source code, just two project files). One for x86 and the other for x64. Add ZeroMQ's x86 package to your x86 one, while ZeroMQ's x64 to your x64. It is ugly, but IHMO it avoids conditioning in your project file (which can be easily broken by any bad MSBuild parser).

Lex Li
  • 60,503
  • 9
  • 116
  • 147
-1

I would think a good place to look would be http://docs.nuget.org/docs/reference/package-manager-console-powershell-reference

As far as I understand NuGet is really just Powershell for Build. I would suggest setting up a conditional build based on the current platform being compiled (86/64) and then filter the Get-Package to the version you need.

MarkWalls
  • 909
  • 8
  • 12