You are probably aware of NuGet by now. It is the “new” way to get 3rd party libraries into your software development projects. Since NuGet 2.0, it is possible to use the Package Restore functionality. While NuGet does have its downsides, it is much better than manually checking for updates for all your libraries.
Why you shouldn’t be using the NuGet Package Restore option
Long before the NuGet team implemented the package restore option, I was using Pepita to retrieve packages that were missing during a build. However, as soon as the NuGet team implemented the feature I thought I no longer needed Pepita. Oh boy, was I wrong…
It is disabled by default
The Package Restore feature is disabled by default. I have no idea why they did it, and frankly, I don’t care. It’s stupid because you need to enable it for every user on the machine. If you have a build server, you are screwed. They only offer the “solution” to define a system environment variable (are you joking, a system environment variable?).
It is slow
When restoring packages via NuGet, you can get a cop of coffee. In the meantime, don’t forget to go to the toitlet too. And in the meantime, also take a walk. No, this is a bit exaggerated, but it isn’t fast.
It must be enabled per project
The user interface is rubbish. You can enable package restore for a solution several times, and you never know whether it actually worked. The menu item is always available and it always seems to do “stuff”. In other words, you simply cannot trust it.
What is Pepita?
Pepita is a pet project of Simon Cropp. Simon was one of the first that found the missing feature about the package restore and decided to do something about it. While he primarily wrote it for himself, he was able to convince me to no longer check in the packages into source control but to let Pepita restore the packages during a build.
While I was sceptical in the beginning, I really started to like this idea because I could ship my solutions everywhere where it only contained code and no references assemblies. Pepita would take care of the package restore and I didn’t need to publish the NuGet packages with my source code.
As I wrote earlier in this blog post, I thought Pepita was gone and I no longer needed it. However, the package restore feature in NuGet was frustrating me because it didn’t work as it should.
At this time, adding Pepita to a project was still manual labour and required a developer to manually edit the project file. I politely asked Simon to introduce a Visual Studio addin which he did. Now Pepita is back, stronger than ever and ready to kick some NuGet ass!
Why you should use Pepita instead of NuGet package restore
It is super fast
No over engineered stuff with MEF where it all needs to be bound together. It is super fast. If no packages are missing, Pepita finishes in just 1 ms:
1> All packages listed in packages.config are already installed.
1> Pepita (version 22.214.171.124) Executing
1> Cache path is C:\Users\Geert\AppData\Local\NuGet\Cache
1> Using PackagesPath: C:\Source\Catel examples\lib
1> Already exists so skipped C:\Source\Catel examples\lib\Catel.Core.3.3.1210251935-beta
1> Already exists so skipped C:\Source\Catel examples\lib\Catel.Extensions.Controls.3.3.1210251935-beta
1> Already exists so skipped C:\Source\Catel examples\lib\Catel.MVVM.3.3.1210251935-beta
1> Already exists so skipped C:\Source\Catel examples\lib\Catel.Fody.126.96.36.199
1> Finished (1ms)
It runs as msbuild task (in-process)
You might be thinking: so what? Well, if you are a professional developer (and I assume you are), you have a build server. This means that Pepita works on build servers out of the box without having to create system environment variables.
It caches downloads
Pepita caches downloads of downloaded packages. This means that if you have to restore Catel.Core.3.3 for 2 different solutions, it will only have to download the package once. This is also very cool when you are not connected to the internet and you need packages restored.
Where can you get it?
Pepita is available in the Visual Studio Gallery.
How does it work?
After you installed the Visual Studio extension, Pepita works extremely simple. Just select a project, go to Project => Pepita => Enable get as you can see in the screenshot below.
The cool thing is that you can now see whether you have package restore enabled for projects. It is also possible to select multiple projects and enable Pepita for all selected projects at once.