How to make NuGet "optional"?

Topics: Ecosystem
Apr 2, 2013 at 10:59 AM
I'm facing a big issue with a client that refuses to install NuGet on his development environment.

I've already developed and released my work using several NuGet packages and enabling the package restore feature, but when the client tries to build the solution, he gest the error message saying that the package restore is disable by default and that "The command "|....nuget\nuget.exe" install ..."" exited with code 1." (obviously, as NuGet isn't installed.

I've tried to make him understand that NuGet doesn't harm their systems, but it seems they are afraid of everything.

Anyway, how can I make them compile the solution, while keeping my development workflow untouched (or touched as less as possible)?
Apr 2, 2013 at 2:36 PM
You might try to ship the packages folder to them, so that they don't need to restore the packages. I did the same when I could not make NuGet working on Mono, but now I no longer need to do that.
Apr 2, 2013 at 2:39 PM
Edited Apr 2, 2013 at 2:40 PM
Thank you lextm,
I was thinking about this, but I'm not sure how I can do this without asking them to take any action (or at least, reducing any action to the minimum).

1- I suppose I should disable the NuGet package restore
2- Shipping the packages folder to them requires at least to set all references, doesn't it? Wouldn't be enough to set each project to copy locally all packages related dlls?
Apr 3, 2013 at 3:44 AM
For Q1, I will use my open source project to describe the steps,
  1. Clone or download the source code from https://github.com/lextm/sharpsnmplib to a machine that has Internet connection.
  2. Execute prepare.bat (copy an snk file) and release.bat (set package restore to true and initialize the build). The binaries are in the bin folder, and the packages are restored to packages folder.
  3. Download the source code cleanly again, and copy to another machine without Internet connection. This simulates the situation of your client.
  4. Now what you need to do is to copy the entire packages folder from the machine in step 1, to the machine in step 3. Then on it you can repeat step 2. NuGet is smart enough to skip package restore as it detects all necessary packages are present.
There is no need to disable package restore at all as far as I can think of, as your other clients might want to play with it.

For Q2 it is rather hard to say whether copy local is efficient. For each existing ways to handle references, they have pros and cons. So far I don't see an obvious way that NuGet should move on to. We will see what's coming in the future.
Apr 3, 2013 at 9:55 AM
I'm not sure I've understood the steps you wrote.

What is the purpose of this .snk file?

Anyway, you say "NuGet is smart enough to skip package restore as it detects all necessary packages are present": the problem is that on my client's machine there isn't NuGet installed (and he doesn't want to install it).
As smart as NuGet could be, when compiling the solution, he gets the error message I wrote above, because VS2010 can't find nuget.exe, even though the SVN repository the client is using to get my update, include both .nuget and packages folders.
Apr 3, 2013 at 11:41 PM
Your client doesn't need to install NuGet. If you commit the .nuget folder into source control, and your client retrieve it, he should be able to compile the project.
Apr 4, 2013 at 9:20 AM
Well, after struggling with this issue for two days, the client admitted that he didn't checkout the whole folder, but only the project folders and solution file.

Thank you for your answers anyway.