Using PowerShell to Install an SDK in a DevOps Build Pipeline

I have an open source UWP project that relies on the Ad SDK and Engagement SDK to be installed to Visual Studio. This normally isn’t a problem, because you can just run the MSI on your PC (see installation instructions here and here).

I decided to move the project into DevOps so that I get some of that CI/CD goodness to build and publish new releases automatically to the Microsoft Store. However, there was a problem, when trying to build the project in a DevOps build pipeline, you’ll get the following error:

This means that the Hosted VS2017 Agent that DevOps uses to build a UWP project doesn’t have the Extensions SDKs installed. I have two choices to move forward:

  • Use a private Agent (this uses your local PC to build the project via a server connection )
  • Find a way to install the SDK into the Hosted agent

I did try the first option. I set up the Windows Agent on my Surface Book, connected it to DevOps and it works nicely (this is why you see that early successful build early in the first screenshot above). However, it’s not a solution for me because it means my PC has to be always on and network-connected.

My friend, and MVP peer, Oren Novotny mentioned that you can actually use a PowerShell script to download the MSI file and install it to the Hosted VS2017, this was the break I was looking for!

To implement this, I downloaded the MSI files I needed from the Visual Studio Marketplace and put them into an Azure Blob. It provides me with two reliable URLs to download the files in the PowerShell script.

Next, I wrote the very simple script. It has two phases: a download phase and an install phase (with a quiet switch “/q”). Here’s what that looks like:

# Predefined Variables
$adSdkUrl = "https://dvlup.blob.core.windows.net/general-app-files/MSIs/MicrosoftAdvertisingSDK.msi"
$servicesSdkUrl = "https://dvlup.blob.core.windows.net/general-app-files/MSIs/MicrosoftStoreServicesSDK.msi"
$adSdkPath = Join-Path $env:TEMP "MicrosoftAdvertisingSDK.msi"
$servicesSdkPath = Join-Path $env:TEMP "MicrosoftStoreServicesSDK.msi"

# Download the files to local temp folder
Write-Output "downloading $adSdkUrl…"
Invoke-WebRequest -Uri $adSdkUrl -OutFile $adSDKPath
Write-Output "downloading $servicesSdkUrl…"
Invoke-WebRequest -Uri $servicesSdkUrl -OutFile $servicesSdkPath

# Install the SDKs (use the "qn" flag to install silently)
Write-Output "installing $adSdkPath…"
Start-Process $adSdkPath -ArgumentList "/q" -Wait
Write-Output "installing $servicesSdkPath…"
Start-Process $servicesSdkPath -ArgumentList "/q" -Wait

Next, you need to add a Powershell step to your DevOps Build pipeline and paste in the script. Here’s a screenshot to help guide you:

Now, when the build is triggered, it will download and install the missing SDKs before building the project! Here’s the result of that build step in the Hosted agent’s console:

I hope this post finds you as soon as you need help. It took me several days, a dozen different documentation articles (some are hyperlinked above) and my MVP peers to find a good simple solution that didn’t require my PC .

Make an Awesome Video for Your App

Nokia has gone to great lengths to make it easy for developers to create promotional materials for their Windows Phone apps. This quick video shows you how to do it.

[youtube=http://www.youtube.com/watch?v=caCZ1w9ZUak?rel=0]

Steps to make your own

  1. Got to the Marketing Toolkit main page (you’ll need to be signed in)
  2. Select the checkbox under “Promotional Video”
  3. Paste in the Store URL to your app
  4. Select the platform of your choice (I chose Lumia 920)
  5. Select a language
  6. Click “Continue”

On the next page:

  1. Select a category
  2. Make sure the app name is correct
  3. Click “Continue”

On the next page, you can choose the words that get displayed during the video, choose the adjectives that best describe your app’s user experience.

  1. Select all three words for your app
  2. Select the screenshot you want to be in the video
  3. Choose the music you want in the video
  4. Click “Preview Video”

You’ll be brought to the preview page. If you want to change something, you can go back and alter your choices.

  1. If you like the video, click “Continue”
  2. Click “Create Video”

You’re almost done, the next steps take involve signing into your youtube account and the video’s full rendering.

Congratulations, you now have a great looking video to promote your app.