Skip to content

Instantly share code, notes, and snippets.

@dburriss
Last active April 4, 2022 19:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dburriss/b4075863873b5871d34e32ab1ae42baa to your computer and use it in GitHub Desktop.
Save dburriss/b4075863873b5871d34e32ab1ae42baa to your computer and use it in GitHub Desktop.
A Powershell script to install Paket dependency manager in current folder (sub-folder .paket)
New-Item -ItemType directory -Path ".paket"
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$tag = (Invoke-WebRequest -Uri https://api.github.com/repos/fsprojects/Paket/releases | ConvertFrom-Json)[0].tag_name
$uri = " https://github.com/fsprojects/Paket/releases/download/" + $tag + "/paket.bootstrapper.exe"
Invoke-WebRequest $uri -OutFile .paket/paket.exe
@dburriss
Copy link
Author

Required: Powershell v5+

You can run the above with a single command

PowerShell -NoProfile -ExecutionPolicy Bypass -Command "iex (Invoke-WebRequest 'https://gist.githubusercontent.com/dburriss/b4075863873b5871d34e32ab1ae42baa/raw/b09c0b3735ef2392dcb3b1be5df0ca109b70d24e/Install-Paket.ps1')"

@dburriss
Copy link
Author

Task for Visual Studio Code

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "paket_setup",
            "type": "shell",
            "command": "powershell",
            "args": [
                "-NoProfile", 
                "-ExecutionPolicy", 
                "Bypass", 
                "-Command", 
                "iex (Invoke-WebRequest 'https://gist.githubusercontent.com/dburriss/b4075863873b5871d34e32ab1ae42baa/raw/b09c0b3735ef2392dcb3b1be5df0ca109b70d24e/Install-Paket.ps1')"
            ]
        }
    ]
}

@dburriss
Copy link
Author

You could install via the dotnet tool

{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "paket_setup",
            "type": "shell",
            "command": "dotnet",
            "args": [
                 "tool", 
                 "install", 
                 "--tool-path", 
                 ".paket", 
                 "Paket", 
                 "--add-source", "https://api.nuget.org/v3/index.json"
            ]
        }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment