3

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.)

Soldalma
  • 4,636
  • 3
  • 25
  • 38
  • 1
    Did you just use `paket add xunit`, or did you also specify the project to add it to? Like `paket add xunit project path/to/project.fsproj` – Honza Brestan Aug 09 '17 at 08:43
  • @HonzaBrestan - Just `paket add xunit`. – Soldalma Aug 09 '17 at 10:52
  • 1
    Ok, that will really only add the xunit to paket.dependencies so that it's downloaded when you run `paket restore`. Try adding it to specific project, it should add it to its paket.references, as well as add reference to dll to the project itself. You can find more detailed behavior in the documentation https://fsprojects.github.io/Paket/paket-add.html – Honza Brestan Aug 09 '17 at 12:04
  • @HonzaBrestan - Thanks. I followed your suggestion and it worked. OTOH when I right-click on References in the Solution Explorer and then choose Add Package I get a dialog box with a blue bar on the top. If I enter the name of a package (say, "Deedle") I get a message "Ignoring error when requesting 'https://api.nuget.org/v3/index.json': Request to 'https://api.nuget.org/v3-flat-container/?q=De?take=1000'" and other similar messages with more letters in the word "Deedle" instead of just "De". Is there a way to fix this? – Soldalma Aug 10 '17 at 09:07
  • @HonzaBrestan - Sorry the message got a bit mangled in the previous comment. I don't know how to deal with all the single quotes. Thre are two semicolons that should not be there. – Soldalma Aug 10 '17 at 09:10
  • 1
    I'm afraid I can't help you with that, I use paket only from command line. In my experience the Paket UI for VS is problematic, sometimes breaks editor, keeps hanging when VS wants to close etc. I suggest visiting its GitHub repository and checking issues if yours has already been reported. – Honza Brestan Aug 10 '17 at 09:58

1 Answers1

4

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.

TeaDrivenDev
  • 6,591
  • 33
  • 50
  • Thanks. As you suggested, I uninstalled and reinstalled the extension and now it is working. I noticed that in the documentation the package to be installed is referenced by the NuGet package ID. How should one proceed to add a package from, say, GitHub or another source? – Soldalma Aug 13 '17 at 05:09
  • 1
    I haven't used that myself, but it's all in the documentation; using single files, repositories, gists.... https://fsprojects.github.io/Paket/github-dependencies.html – TeaDrivenDev Aug 13 '17 at 14:59