Skip to main content

Use dotnet rc2 with appveyor

dotnet CLI is currently in RC2, and while the train is fast approaching RTM, most tools are still catching up. dotnet seems to have a documented cli based install for every platform except the good ol windows. That being said getting a windows based install/build is possible.

Place the following powershell as the before build step in appveyor. In short, download the installer, run it, and then restore your nuget packages. I got the flags for the installer by running the installer with /?

(new-object net.webclient).DownloadFile('','core.exe')

    core.exe /install /quiet /norestart
    dotnet restore

if you have solution files, and a project system them appveyor should build the project automatically. If you don't then set the build command to be dotnet build .\path\to\your\proj

Since aspnet core builds to not emit dependent dll's appveyor's auto detect and run for tests doesn't work. Make sure you have added the test runner to your project.json and just run dotnet test .\path\to\your\tests as your test_script of your appveyor.yml file

You can find a working example here

tl;dr appveyor.yml:

version: 1.0.{build}
configuration: Release
- ps: >-
    (new-object net.webclient).DownloadFile('','core.exe')

    core.exe /install /quiet /norestart

    dotnet restore
  verbosity: minimal
- cmd: dotnet test .\path\to\mytests
Tagged In:
appveyor dotnet