ASP.NET 5 beta8, CI and Azure

This is the fourth post in a series about building Wedding Planner Tools Web App with ASP.NET 5, MVC 6 and Entity Framework 7. The previous post was about updating the project to use beta8 and the coreCLR runtime. This is the first post of the series.

I then tried to deploy to azure and see what happens (by pushing to VSO and letting the CI do it’s magic) and I got this error: The project being published does not support the run time ‘dnx-clr-win-x86.1.0.0-beta8’. This is apparently a known issue The workaround is to specifically set the target DNX version in the settings tab of the publish dialog. This helps with the problem when you publish from Visual Studio.

I then added the specific runtime and architecture int prebuild.ps1 file for dnvm install to ensure the correct sdk gets installed on the build agent vm. I wanted to remove the Visual Studio build step and replace it with executing dnu build as a command line step. The step was failing because of missing dnx. I then added -g to dnvm install to install it globally. but this didn’t work either. It seems that changes to the path just aren’t carried over to the next execution step (this is weird but I don’t have the time to understand why it is so). So then I ran into this post and tried building and deploying via power shell script only in one step. I added the build and publish commands to Prebuild.ps1. Power shell arguments for build step ended up looking like this:

-vsoProjectName "WeddingPlannerTools" -projectName "WeddingPlannerTools" -BuildConfiguration $(BuildConfiguration) -buildSourcesDirectory $(Build.SourcesDirectory)


param([string]$projectName="", [string]$BuildConfiguration="", [string]$vsoProjectName="", [string]$buildSourcesDirectory="")
# bootstrap DNVM into this session.
# load up the global.json so we can find the DNX version
$globalJson = Get-Content -Path $PSScriptRoot\global.json -Raw -ErrorAction Ignore | ConvertFrom-Json -ErrorAction Ignore

    $dnxVersion = $globalJson.sdk.version
	$dnxRuntime = $globalJson.sdk.runtime
	$dnxArchitecture = $globalJson.sdk.architecture
    Write-Warning "Unable to locate global.json to determine using 'latest'"
    $dnxVersion = "latest"
	$dnxRuntime = "coreclr"
	$dnxArchitecture ="x86"


# install DNX
# only installs the default (x86, clr) runtime of the framework.
# If you need additional architectures or runtimes you should add additional calls
# ex: & $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -r coreclr
& $env:USERPROFILE\.dnx\bin\dnvm install $dnxVersion -a $dnxArchitecture -r $dnxRuntime -Persistent

 # run DNU restore on all project.json files in the src folder including 2>1 to redirect stderr to stdout for badly behaved tools
Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }

& "dnu" "build" "$PSScriptRoot\src\$projectName" "--configuration" "$BuildConfiguration"
& "dnu" "publish" "$PSScriptRoot\src\$projectName" "--configuration" "$BuildConfiguration" "--out" "$buildSourcesDirectory\$vsoProjectName\artifacts\bin\$BuildConfiguration\Publish" "--runtime" "active"

Dnu publish is logging npm warnings as errors for some reason so I’ve set continue on error for this step for now. I just want to see it published!

npm WARN package.json ASP.NET@0.0.0 No description
npm WARN package.json ASP.NET@0.0.0 No repository field.
npm WARN package.json ASP.NET@0.0.0 No README data
npm WARN package.json ASP.NET@0.0.0 No license field.

This is how the build steps look on VSO:
Build steps

Finally follow this guide to make the up run on azure:, With this changes you should be able o run the app in IISExpress also but for me it does not seem to work (HTTP Error 500.19 – Internal Server Error but I don’t have the energy to fight it:) ). It does however work in Azure! Success!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s