ASP.NET 5 vNextFor those who do not know, AppVeyor is Continuous Integration and Deployment service for .NET projects. It is free for open-source projects.

Currently, AppVeyor supports latest DNX version (1.0.0-rc1-final) and I've recently migrated my pet project to this version. I will show you how easy it is to build and run all unit tests on CI server every time you commit to GitHub.

Visual Studio project (MSBuild)

In LearnWordsFast project we are using Visual Studio 2015 as a development environment, so in AppVeyor we can use default configuration with a bit of tweaking.

By default AppVeyor will use MSBuild to build your project. Here is the steps needed to configure AppVeyor:

  • Restore nuget packages.  Set dnu restore as "before build script" in build settings.
  • Configure custom test command. Set dnx -p test/LearnWordsFast.Test test script in a test settings.

Now your project is ready for build and test. Just press "New Build" button.

It is also recomended to keep your CI settings in a repo. So just put appveyor.yml in your repo:

version: 1.0.{build}
before_build:
- cmd: dnu restore
test_script:
- cmd: dnx -p test/LearnWordsFast.Test test
build:
  verbosity: normal

You can use following links as examples:

GitHub: https://github.com/drussilla/LearnWordsFast

AppVeyor: https://ci.appveyor.com/project/druss/learnwordsfast

DNX project

I have also created "pure" dnx project. No *.sln or *.xproj files. To build it with AppVeyor you just need to change build script setting

Set dnu build src\Backend test\Backend.Test as a cmd script in build settings.

I have also added one optimization to reduce build time. By default, every time you build your project AppVeyor creates a clean environment. We can save our packages folder, so dnu restore does not need to download all packages every build. Add C:\Users\appveyor\.dnx\packages folder to "Cached directories and files" in Environment settings.

Resulted appveyor.yml:

version: 1.0.{build}
cache: C:\Users\appveyor\.dnx\packages
before_build:
- cmd: dnu restore
build_script:
- cmd: dnu build src\Backend test\Backend.Test
test_script:
- cmd: dnx -p test/Backend.Test test
build:
  verbosity: normal

You can use following links as examples:

GitHub: https://github.com/drussilla/EmptyDnxApplication

AppVeyor: https://ci.appveyor.com/project/druss/emptydnxapplication

You can just copy EmptyDnxApplication repo and use it as a skeleton for your own projects.

In the next article, I will show you how to deploy your APS.NET 5 application to a Linux server using AppVeyor deployment functionality.