Search code examples
f#nugetpaket

Why can't I add packages with Paket?


I followed the instructions in the answer by smoothdeveloper in How to use paket from command line and now I have all three Paket directories in my solution. However, I cannot add packages either from the command line or from VS 2017.

I tried to add XUnit from the command line. A line with nuget xunit appeared in the paket.dependencies file. But there is no xunit line in the paket.references file. If I add open XUnit or any variation (Intellisense does not show anything starting with xu) to my code in the editor I get a red squiggly line.

So I tried to add XUnit from the solution explorer. Right-clicking on something (I tried several places) I should get an Add package menu item. But no such item shows up.

I must have done something wrong, but I cannot figure it out. Any help?

(Also, perhaps related, if I click on the Download button in https://marketplace.visualstudio.com/items?itemName=SteffenForkmann.PaketforVisualStudio nothing happens.)


Solution

  • There are two ways to add packages to individual projects from the command line with Paket using parameters for paket add (as documented in https://fsprojects.github.io/Paket/paket-add.html):

    • -p <path> (or --project <path>) to install into one specific project
    • -i (or --interactive) to be asked for each project in the solution whether to reference the package

    FWIW, I also had no problems adding a package from the Visual Studio integration; you could try un- and reinstalling the extension, maybe there's some wrong configuration setting that can be fixed that way.