Building ASP.NET 5 (Core 1.0) with Visual Studio Team Services

In this post I will show you how to build a ASP.NET 5 1.0.0-rc1-update1 project with Visual Studio Team Services.

First make sure you have the latest version from  Download and run the installer.  Once the installation is complete run the following command to get the latest version of the runtime.

dnvm upgrade

Now using Visual Studio 2015 Update 2 create a new ASP.NET 5 Web Application.


Commit your changes into Visual Studio Team Service. With all your code in source control, we can now create our build definition.

  1. Log in to Visual Studio Team Service
  2. Click the Build hubimage_thumb4
  3. Click the green plus 
  4. Select the Visual Studio template
  5. Click Next
  6. Select your repository
  7. Check the box for Continuous integration
  8. Click Create

With the build created, we need to add the required tasks.

  1. Click Add build step…
  2. Select the Utility category
  3. Click Add next to the PowerShell task
  4. Click Close image
  5. Drag and drop the PowerShell task to the top
  6. Select the PowerShell task 
  7. Change the Type to Inline Script
  8. Enter the following code for Inline Script (double click code to copy) 
    &{$Branch='dev';iex ((new-object net.webclient).DownloadString(''))}
    $gJson = gc -Path .\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore
    $dnxVersion = $gJson.sdk.version
    & $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -Persistent
    dir -Path .\ -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }
  9. Click Save
  10. Give your build a name
  11. Click OK
  12. Click Queue build…
  13. Click OK

Comments (3) -

  • Daniel

    4/11/2016 8:31:15 AM | Reply

    I've tried to reproduce your demo but I've got the below error:
    2016-04-11T08:27:06.9458836Z . 'C:\Users\buildguest\AppData\Local\Temp\87e0c8dc-e376-4d53-b361-9d2dd624d370.ps1'
    2016-04-11T08:27:07.0720366Z Executing the following powershell script. (workingFolder = C:\a\1\s)
    2016-04-11T08:27:07.0720366Z C:\Users\buildguest\AppData\Local\Temp\87e0c8dc-e376-4d53-b361-9d2dd624d370.ps1
    2016-04-11T08:27:11.8137267Z Using temporary directory: C:\Users\BUILDG~1\AppData\Local\Temp\dnvminstall
    2016-04-11T08:27:11.9264887Z Downloading DNVM.ps1 to C:\Users\BUILDG~1\AppData\Local\Temp\dnvminstall\dnvm.ps1
    2016-04-11T08:27:11.9969791Z Downloading DNVM.cmd to C:\Users\BUILDG~1\AppData\Local\Temp\dnvminstall\dnvm.cmd
    2016-04-11T08:27:12.0382231Z Installing DNVM
    2016-04-11T08:27:13.8283083Z Installing .NET Version Manager to C:\Users\buildguest\.dnx\bin
    2016-04-11T08:27:13.8583058Z Creating destination folder 'C:\Users\buildguest\.dnx\bin' ...
    2016-04-11T08:27:13.8663056Z Installing 'dnvm.ps1' to 'C:\Users\buildguest\.dnx\bin' ...
    2016-04-11T08:27:13.8773053Z Installing 'dnvm.cmd' to 'C:\Users\buildguest\.dnx\bin' ...
    2016-04-11T08:27:13.8843044Z Adding C:\Users\buildguest\.dnx\bin to Process PATH
    2016-04-11T08:27:14.0695276Z Adding C:\Users\buildguest\.dnx\bin to User PATH
    2016-04-11T08:27:15.2393503Z A version, nupkg path, or the string 'latest' must be provided.
    2016-04-11T08:27:15.4166222Z dnvm install
    2016-04-11T08:27:15.4216225Z   Installs a version of the runtime
    2016-04-11T08:27:15.4226199Z usage:
    2016-04-11T08:27:15.5492345Z   dnvm install [<VersionNuPkgOrAlias>] [-a <Architecture>] [-r <Runtime>] [-OS <OS>] [-Alias <Alias>] [-f] [-Proxy <Proxy>] [-NoNative] [-Ngen] [-p] [-u] [-g]
    2016-04-11T08:27:15.5512342Z options:
    2016-04-11T08:27:15.5682348Z   <VersionNuPkgOrAlias> The version to install from the current channel, the path to a '.nupkg' file to install, 'latest' to
    2016-04-11T08:27:15.5682348Z install the latest available version from the current channel, or an alias value to install an alternate
    2016-04-11T08:27:15.5692344Z runtime or architecture flavor of the specified alias.
    2016-04-11T08:27:15.5722341Z   -a                   The processor architecture of the runtime to install (default: x86)
    2016-04-11T08:27:15.5752344Z   -r                   The runtime flavor to install (default: clr)
    2016-04-11T08:27:15.5782346Z   -OS                  The operating system that the runtime targets (default: win)
    2016-04-11T08:27:15.5812343Z   -Alias               Set alias <Alias> to the installed runtime
    2016-04-11T08:27:15.5842343Z   -f                   Overwrite an existing runtime if it already exists
    2016-04-11T08:27:15.5872904Z   -Proxy               Use the given address as a proxy when accessing remote server
    2016-04-11T08:27:15.5892345Z   -NoNative            Skip generation of native images
    2016-04-11T08:27:15.5942342Z   -Ngen                For CLR flavor only. Generate native images for runtime libraries on Desktop CLR to improve startup time. This option requires elevated privilege and will be automatically turned on if the script is running in administrative mode. To opt-out in administrative mode, use -NoNative switch.
    2016-04-11T08:27:15.5982334Z   -p                   Make the installed runtime useable across all processes run by the current user
    2016-04-11T08:27:15.6022339Z   -u                   Upgrade from the unstable dev feed. This will give you the latest development version of the runtime.
    2016-04-11T08:27:15.6052340Z   -g                   Installs to configured global dnx file location (default: C:\ProgramData)
    2016-04-11T08:27:15.6072334Z remarks:
    2016-04-11T08:27:15.6172328Z   A proxy can also be specified by using the 'http_proxy' environment variable
    2016-04-11T08:27:29.0973984Z ##[error]& : The term 'dnu' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
    2016-04-11T08:27:29.0983987Z ##[error]spelling of the name, or if a path was included, verify that the path is correct and try again.
    2016-04-11T08:27:29.0996227Z ##[error]At C:\Users\buildguest\AppData\Local\Temp\87e0c8dc-e376-4d53-b361-9d2dd624d370.ps1:5 char:65
    2016-04-11T08:27:29.1015419Z ##[error]+ dir -Path .\ -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.F ...
    2016-04-11T08:27:29.1023991Z ##[error]+                                                                 ~~~
    2016-04-11T08:27:29.1043989Z ##[error]    + CategoryInfo          : ObjectNotFound: (dnu:String) [], CommandNotFoundException
    2016-04-11T08:27:29.1043989Z ##[error]    + FullyQualifiedErrorId : CommandNotFoundException
    2016-04-11T08:27:29.1055048Z ##[error]
    2016-04-11T08:27:29.1063994Z ##[error]Process completed with exit code 1003 and had 1 error(s) written to the error stream.

    • Donovan

      5/20/2016 3:16:42 PM | Reply

      Check that you don't have a typo in the script.

  • Henrique Graca

    4/11/2016 9:05:42 AM | Reply

    Great tutorial, as always. keep up the excellent work.

Add comment