mercredi 21 octobre 2015

Using AppVeyor CI to build a Windows Phone 8.1 XAML App with Ad Mediator and Player Framework, what I had to do, to make it work!

What I want to do:
As a developer I am LAZY and like to make sure that when I push code to my GitHub repo that it doesn’t break everything, that is why I love AppVeyor. AppVeyor will build my app or code every time a push code to Github.

Lets get Started:
I have create a sample application called ‘’ExampleApp‘’ which contains the references that can’t just installed using nugget.

Usually on AppVeyor to load the libraries needed to build the application you would go into settings:

Then into Build:

And making sure that before the build is built you launch a script that will restore all of your nuget packages: nuget restore ExampleApp \ExampleApp.sln

Side note: make sure that you select platform version x86, ARM or else Ad Mediation will not build.

For our sample app that I want AppVeyor to build, I will add 2 references Ad Mediator and Microsoft player Framework before the application is built:

Here is a screenshot of the references of my app:

AppVeyor cannot load these references using nuget, so we are going to have to write a PowerShell script (please don’t start running this will be simple!! I Promise).

AppVeyor spawn a VM every time you launch a build of your project so running a PowerShell script should be easy! And its even easier thanks to their interface.

To Start:

You need to find the correct .msi & .vsix files needed to be installed on the machine.  Here are the Urls for the two files that I need to install:

  1. For Ad Mediation the url is ‘’ 

  2. For Player Framework 2.0 the Url is ‘’

Once you have found those urls we can use this PowerShell script:

Write-Host "Installing Microsoft Universal Ad Client SDK..."
$msiPath = "$($env:USERPROFILE)\AdMediator.msi"
(New-Object Net.WebClient).DownloadFile('', $msiPath)
cmd /c start /wait msiexec /i $msiPath /quiet
Write-Host "Installed" -ForegroundColor green
Write-Host "Installing Microsoft Player Framework 2.0 ..."
$vsixPath = "$($env:USERPROFILE)\Microsoft.PlayerFramework.vsix"
(New-Object Net.WebClient).DownloadFile('', $vsixPath)
"`"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\VSIXInstaller.exe`" /q /a $vsixPath" | out-file ".\install-vsix.cmd" -Encoding ASCII
& .\install-vsix.cmd
Write-Host "Installed" -ForegroundColor green

side note: remember that this script needs to run before the build is launched.

Launch your build and Eureka, the build passes:

I hoped this small tutorial has helped you out in better using AppVeyor.

Bonus 1
You can connect to the VM AppVeyor spawns to debug and see what packages you are missing using:

$blockRdp = $true; iex ((new-object net.webclient).DownloadString(''))

In the console you will get the information you need (Server IP, Username, Password) to connect to the VM using a Remote Desktop:

Bonus 2
AppVeyor allow you to have a badge on your Github repo which allows you to know if the build is building or not =).  This can be found in MyProject -> Settings -> Badges, here is an example of my badge

 PS: this is my first post, so please don’t hesitate to writ e comment and tell me if you liked it or not!