10

I installed paket from nuget in Nuget Package Manager Console with:

Install-Package paket

I then tried to run paket convert-from-nuget. It stalled out on a user prompt (it wouldn't let me type into the package manager console). My next thought was to run it from command line, but how to do so is not documented.

Just putting paket convert-from-nuget into a standard dev command prompt results in an error saying "paket" is not recognized.

How do I run paket from the command line or powershell, and how do you specify which solution to work against?

BradleyDotNET
  • 57,599
  • 10
  • 90
  • 109

2 Answers2

9

The way to setup paket in your repository is as follow:

1 Download a release of paket.bootstrapper.exe

This is a lightweight utility which obtains and updates paket.exe, pick stable release from official release page:

https://github.com/fsprojects/Paket/releases

2 create a .paket folder

md .paket

3 put the downloaded bootstrapper in this folder and invoke it

cd .paket
paket.bootstrapper

now you have an up-to-date paket.exe ready to ease your handling of dependencies.

4 convert from nuget

cd ..
.paket\paket convert-from-nuget

Please checkout the https://github.com/fsprojects/Paket.VisualStudio also for Visual Studio plugin to help you authoring paket.dependencies and paket.references file

Please also join https://gitter.im/fsprojects/Paket if you have any questions.

smoothdeveloper
  • 1,817
  • 18
  • 18
4

The Chocolatey package modifies the PSModulePath envivornment variable. I've observed that sometimes that modification isn't picked up until the system is restarted (or at least not until the user logs out and back in again). In the meantime, you can import the module using:

Import-Module <path-to-packages>\Paket.PowerShell\Paket.PowerShell.psd1

The packages path is usually something like C:\Chocolatey\lib. OTOH, re-reading your question, are you referring to the Nuget inside of Visual Studio? If so, that downloads from NuGet.org and that pkg puts paket.exe in $(SolutionDir)\packages\Pakget.1.18.5\tools\paket.exe. Your version number may varying.

Unfortunately the fact that PowerShell V5 introduces Install-Package (which downloads from Chocolatey by default) is going to get a little confusing vis-a-vie the NuGet Package Manager Console's Install-Package in Visual Studio.

Keith Hill
  • 173,872
  • 36
  • 316
  • 347
  • Yes, I was referring to installing via nuget in visual studio. So to use it outside of it, I need to navigate to the version in the solution dir or install it separately in powershell? For the latter, how do you specify the solution? – BradleyDotNET Jul 06 '15 at 23:38
  • The version that comes from Visual Studio doesn't install a PowerShell module. So for it, you can just specify the path to the \tools\paket.exe e.g. `& 'C:\users\foo\documents\visual studio 2013\projects\acme\packages\paket.1.18.5\tools\paket.exe' arg1 arg2` – Keith Hill Jul 07 '15 at 01:27
  • Thanks for the info. I am still curious as to the method of specifying a solution when using the power shell module – BradleyDotNET Jul 07 '15 at 01:51
  • PowerShell modules get installed into well-known locations. So when you want to use the commands from a module, you just do an import of the module e.g. `Import-Module `. That will make the module's commands available for use. If the module is well designed, PowerShell can find the associated module and automatically import it when you try to use one of its commands. On a system with PowerShell and Chocolatey installed (chocolatey.org for install instructions), execute `choco install paket.powershell -y` to install the module. – Keith Hill Jul 07 '15 at 02:43
  • BTW this isn't a particularly well-mannered PowerShell module. It seems to have verb & noun backwards in the command names. – Keith Hill Jul 07 '15 at 02:44