Migrating from NuGet to Paket in Visual Studio
NuGet was supposed to be Microsoft's answer to package management for .NET applications. "Supposed to be" is the key phrase. I've been involved with enough projects, and done enough coding in ASP.NET, to know that with NuGet, you certainly can't get an "ought" from an "is," and NuGet is often a primary pain for people participating in large projects, or who have custom needs.
Want a real world example? Take a look at this snippet from an actual README file I had to create at work:
When this project was first started, it was a vanilla ASP.NET MVC 5 project with Web API 2 included (from the template wizard). When Visual Studio combines those two together, it apparently leaves out the API help pages, so I had to move that code over manually. Once that was moved over, references were missing, but in addition to the
Microsoft.AspNet.WebApi.HelpPage DLL being "missing," I was still getting errors about the rest of the MVC files. For some reason, despite being a vanilla project, all of the packages were out of date, and thus required the
No problem. Run once, check in, and you're golden, right? Nope. Despite the project being in a good state, even with the packages.config file checked in, the next developer had the same issue. In fact, all fresh installs had the same issue, and because of that, I was forced to create the README for information purposes.
While experimenting with F#, I came across Paket, which uses NuGet, but processes references in a slightly different manner. After asking the community if they've ever successfully migrated to Paket, I decided to give it a shot. After downloading and installing the Paket files in the appropriate directory, I ran
paket convert-from-nuget to convert my project over. It worked perfectly, and after running with it for a week or so, I finally checked it all into our on-premise Team Foundation Server (TFS).
The true test came several weeks later when we hired a new programmer. Under the standard NuGet package management, he would have gotten the same issues I experienced above (another programmer on our team experienced those same issues after pulling from source control), but with Paket, the issue was resolved. In fact, when I put together the build definition on our TFS server to process the build of the project, I used the Paket extension to restore all packages from Paket rather than NuGet, and once again, it worked perfectly.
For those deeply invested in Visual Studio, there is a Visual Studio extension that works great, and Visual Studio Code has an extension through the Ionide suite. Both do a tremendous job of making your tooling easier.