The blogs of Black Marble staff

Build 2016 - Overview

Overall I must say that I found this to be one of the best Build's yet. The keynotes had people cheering and applauding almost none stop, the content in the sessions was exemplary and the expo hall and was fun to spend time in with lots of interesting stands to talk to people on.

My only regret is that I didn't have as much time to spend in a actual sessions due to my running around doing other things. Though I have been watching sessions that I missed at                                             to catch up and continue learning.

If you want to see more photos of our time at Build please check out our Facebook page at

Or if you want to follow us on twitter you can find us at                                                                   Follow us to keep track of all our fun exploits in programming

Thank you :D






How to build a connection string from other parameters within MSDeploy packages to avoid repeating yourself in Release Management variables

Whilst working with the new Release Management features in VSTS/TFS 2015.2 I found I needed to pass in configuration variables i.e. server name, Db name, UID and Password to create a SQL server via an Azure Resource Management Template release step and a connection string to the same SQL instance for a web site’s web.config, set using an MSDeploy release step using token replacement (as discussed in this post)

Now I could just create RM configuration variables for both the connection string and ARM settings,



However, this seems wrong for a couple of reason

  1. You should not repeat your self, too easy to get the two values out of step
  2. I don’t really want to obfuscate the whole of a connection string in RM, when only a password really needs to be hidden (note the connection string variable is not set as secure in the above screenshot)

What did not work

I first considered nesting the RM variables, e.g. setting a the connection string variable to be equal to ‘Server=tcp: $(DatabaseServer),1433;Database=$(DatabaseName)….’, but this does not give the desired results, the S(DatabaseServer) and $(DatabaseName) variables are not expanded at runtime, you just get a string with the variable names in it.

How I got want I was after….

(In this post as a sample I am using the Fabrikam Fiber solution. This means I need to provide a value for the FabrikamFiber-Express connection string)

I wanted to build the connection string from the other variables in the MSDeploy package. So to get the behaviour I want…

  1. In Visual Studio load the Fabrikam web site solution.
  2. In the web project, use the publish option to create a publish profile use the ‘WebDeploy package’ option.
  3. If you publish this package you end up with a setparameter.xml file containing the default connection string
    <setParameter name="FabrikamFiber-Express-Web.config Connection String" value="Your value”/>
    Where ‘your value’ is the value you set in the Publish wizard. So to use this I would need to pass in a whole connection string, where I only want to pass parts of this string
  4. To add bespoke parameters to an MSDeploy package you add a parameter.xml file to the project in Visual Studio (I wrote a Visual Studio Extension that help add this file, but you can create it by hand). My tool will create the parameters.xml file based on the AppSettings block of the projects Web.config. So if you have a web.config containing the following
        <add key="Location" value="DEVPC" />
    It will create a parameters.xml file as follows
    <?xml version="1.0" encoding="utf-8"?>
      <parameter defaultValue="__LOCATION__" description="Description for Location" name="Location" tags="">
        <parameterentry kind="XmlFile" match="/configuration/appSettings/add[@key='Location']/@value" scope="\\web.config$" />
  5. If we publish at this point we will get a setparameters.xml file containing
    <?xml version="1.0" encoding="utf-8"?>
      <setParameter name="IIS Web Application Name" value="__Sitename__" />
      <setParameter name="Location" value="__LOCATION__" />
      <setParameter name="FabrikamFiber-Express-Web.config Connection String" value="__FabrikamFiberWebContext__" />
    This is assuming I used the publish wizard to set the site name to __SiteName__ and the DB connection string to __FabrikamFiberWebContext__
  6. Next step is to add my DB related parameters to the paramaters.xml file, this I do by hand, my tool does not help
    <?xml version="1.0" encoding="utf-8"?>
      <parameter defaultValue="__LOCATION__" description="Description for Location" name="Location" tags="">
        <parameterentry kind="XmlFile" match="/configuration/appSettings/add[@key='Location']/@value" scope="\\web.config$" />

      <parameter name="Database Server" defaultValue="__sqlservername__"></parameter>
      <parameter name="Database Name" defaultValue="__databasename__"></parameter>
      <parameter name="Database User" defaultValue="__SQLUser__"></parameter>
      <parameter name="Database Password" defaultValue="__SQLPassword__"></parameter>
  7. If I publish again, this time the new variables also appear in the setparameters .xml file
  8. Now I need to supress the auto generated creation of the connection string  parameter, and replace it with a parameter that uses the other parameters to generate the connection string. You would think this was a case of added more text to the parameters.xml file, but that does not work. If you add the block you would expect (making sure the name matches the auto generated connection string name) as below
      defaultValue="Server=tcp:{Database Server},1433;Database={Database Name};User ID={Database User}@{Database Server};Password={Database Password};Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;"
      description="Enter the value for FabrikamFiber-Express connection string"
      name="FabrikamFiber-Express-Web.config Connection String"
        scope="\\web.config$" />

    It does add the entry to setparameters.xml, but this blocks the successful operations at deployment. It seems that if a value needs to be generated from other variables there can be no entry for it in the setparameters.xml. Documentation hints you can set the Tag to ‘Hidden’ but this does not appear to work.

    One option would be to let the setparameters.xml file be generated and then remove the offending line prior to deployment but this feels wrong and prone to human error
  9. To get around this you need to added a file name <projectname> to the same folder as the project (and add it to the project). In this file place the following
    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="">
    <Target Name="DeclareCustomParameters"
          <MsDeployDeclareParameters Include="FabrikamFiber-Express">
            <Description>Enter the value for FabrikamFiber-Express connection string</Description>
            <DefaultValue>Server=tcp:{Database Server},1433;Database={Database Name};User ID={Database User}@{Database Server};Password={Database Password};Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;</DefaultValue>

    The first block declares the parameter I wish to use to build the connection string. Note the ‘ExcludeFromSetParameter’ setting so this parameter is not in the setparameters.xml file. This is what you cannot set in the parameters.xml

    The second block stops the auto generation of the connection string. (Thanks to Sayed Ibrahim Hashimi for various posts on getting this working)
  10. Once the edits are made unload and reload the project as the <project>. wpp.targets file is cached on loading by Visual Studio.
  11. Make sure the publish profile is not set to generate a connection string

  12. Now when you publish the project, you should get a setparameters.xml file with only the four  SQL variables, the AppSettings variables and the site name.
    (Note I have set the values for all of these to the format  __NAME__, this is so I can use token replacement in  my release pipeline)
    <?xml version="1.0" encoding="utf-8"?>
      <setParameter name="IIS Web Application Name" value="__Sitename__" />
      <setParameter name="Location" value="__LOCATION__" />
      <setParameter name="Database Server" value="__sqlservername__" />
      <setParameter name="Database Name" value="__databasename__" />
      <setParameter name="Database User" value="__SQLUser__" />
      <setParameter name="Database Password" value="__SQLPassword__" />
  13. If you deploy the web site, the web.config should have your values from the setparameters.xml file in it
       <add key="Location" value="__LOCATION__" />
         <add name="FabrikamFiber-Express" connectionString=",1433;Database=__databasename__;User ID=__SQLUser__@__sqlservername__;Password=__SQLPassword__;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" providerName="System.Data.SqlClient" />

You are now in a position manage the values of the setparameters.xml file however you wish. My choice is to use the ‘Replace Tokens’ build/release tasks from Colin’s ALM Corner Build & Release Tools Extension, as this tasks correctly handles secure/encrypted RM variables as long as you use the ‘Secret Tokens’ option on the advanced menu.




So yes, it all seems a but too complex, but it does work, and I think it makes for a cleaner deployment solution, less prone to human error. Which is what any DevOps solution must always strive for.

Depending on the values you put in the <project>.wpp.targets you can parameterise the connection string however you need.

UWP-Using WebAccountManager API to connect your Windows 10 to Microsoft Account

Prior to Windows 10 UWP the recommendation for federated authentication in Windows was (and still is) to use

If you have a Windows 10 UWP application you have a new platform capability available to you called the WebAccountManager. This is the recommended approach going forward from Windows 10.

The Windows 10 UWP samples available on github contain a sample WebAccountManagement which shows you how to integrate your app with Azure AD, Live connect, Local, and other identity providers.

I’ve been through the sample and distilled the key points for Microsoft Account integration.

  1. Provide a handler for AccountsSettingsPane.GetForCurrentView().AccountCommandsRequested.  This is the method that windows will execute when the ‘login’ dialog is shown in your app.  At this stage you add the identity providers you want users to be able to log in with.
  2. Per provider, provide a handler for WebAccountProviderCommand. This is the method that windows will execute when the user has selected the identity provider from the list defined at stage 1.  At this stage, you will be physically issuing a login request using the WebAuthenticationCoreManager.  At the end of this handler, you should have a login result (success/fail) and a token which you can use in downstream processing.
  3. From your client (UWP app), tell the app to show the action settings page using Windows.UI.ApplicationSettings.AccountsSettingsPane.Show().  This will start the login process, and accordingly trigger the above handlers when users have interacted with the account settings pane.

   Below is the code to implement steps 1 and 2.  Note in this example I am using MVVM light dispatcher (Messenger.Default.Send) to deliver an event based message to subscribers.  You can use something like event aggregator or your flavour of pub/sub framework to achieve the same result:

public class Authenticator


    public Authenticator()


        AccountsSettingsPane.GetForCurrentView().AccountCommandsRequested += Authenticator_AccountCommandsRequested;



    private async void Authenticator_AccountCommandsRequested(AccountsSettingsPane sender, AccountsSettingsPaneCommandsRequestedEventArgs e)


        AccountsSettingsPaneEventDeferral deferral = e.GetDeferral();

        var provider =

            await WebAuthenticationCoreManager.FindAccountProviderAsync("", "consumers");

        WebAccountProviderCommand providerCommand = new WebAccountProviderCommand(provider, WebAccountProviderCommandInvoked);


        e.HeaderText = "Please select an account to log in with";




    private async void WebAccountProviderCommandInvoked(WebAccountProviderCommand command)


        WebTokenRequest webTokenRequest = new WebTokenRequest(command.WebAccountProvider, "wl.basic", "none");

        WebTokenRequestResult webTokenRequestResult = await WebAuthenticationCoreManager.RequestTokenAsync(webTokenRequest);

        var token = webTokenRequestResult.ResponseData[0].Token;

        // sends a message with MVVM Light messenger. This is solution specific, typically you want to use the token to

        // query a service (for example live connect)

        Messenger.Default.Send(new AuthenticatedMessage() { Token = token});




And below is the code to implement step 3:



 Further reading

I’d encourage you to have a good look at the WebAccountManagement sample in  This samples contains more detail and different usage scenarios for reference.

Also have a look at Vittorio Bertocci’s post at which gives a bit of background, explains when you should use ADAL.NET vs WebAccountmanager and has example of integrating with Azure AD.

Build 2016 - The Freebies

This year it was hoped that since there would be no hardware giveaways that the number of giveaways around and about the conference would go up as well. Well we weren't disappointed. The number of competitions to win freebies was high with surface books and phones on offer. Hour competitions were run on twitter by Microsoft dev and there was even a student only twitter competition. To aid in our competition every student was given a branded selfie sticks to show how much fun we were having there. Though unfortunately I didn't win any hardware we managed to walk away with a lot of other cool freebies such as..

This cool looking Visual Studio lunchbox which came with a handy multi tool keying, Visual Studio socks and a Visual Studio wrist band. I fully intend on taking this into uni to make those on my course jealous.

Game of Thrones/Star Wars planning poker cards. If planning poker wasn't fun enough for you already then using these are sure to make it an even more joyous experience.

Enough clothes to last a lifetime. Another Visual Studio/Game of Thrones themed freebie this time in the form of a T-Shirt with a Kanban board as the design featuring such  tasks as under planning Arya has to complete revenge. Warning before looking closer said shirt does include spoilers.... And so many pairs of socks. Say what you will but I've never had a pair of Microsoft socks that weren't comfy. And yes that means I have had them before.

Niamh really managed to nab some swag in the form of cushions, posters, stickers, sweets and so many more things including an odd squishy brain...

Build 2016 - Andy Wigley

As Build was closing up we were lucky to quickly grab some of Andy Wigley's time before we were kicked out. Andy Wigley is a technical evangelist in the UK and works primarily with Universal Apps on phone and tablet. Listen to me talk to him about how he found his time at Build and what he likes most about Windows :D

Build 2016 - Richard Campbell

On the last day of Build Richard Campbell was kind enough to spare us some time for an interview. Having already being lovely enough to help us out the day before we were thrilled that he agreed. Richard is one of the people behind .NET Rocks! A weekly show for those interested in the .NET platform. Watch me talk to him about the cool things he had seen at Build and what he thinks can be done to help students get themselves out there.

Then watch Niamh ask him how we can get more children into programming :)

Niamh gets really into it sometimes.

Build 2016 - Craig Kitterman

On Thursday afternoon we were able to borrow Craig Kitterman for some short interviews :) Craig works in the product marketing organisation for developer tools and cloud services. Watch me speak to him about some of the cool things seen at Build and what he likes about Visual Studio.

Then watch me talk to him about what he thinks we can do to get more children into programming.

Build 2016 - Gabriel Aul

At lunchtime on the Thursday we had managed to grab some of Gabel Aul's time for a quick interview. Gabe is head of the Windows Insider program which allows you to receive preview builds of Windows. Watch me ask him about some of the cool things he had seen at Build and his favourite parts of Windows :D

Then watch Niamh ask him about what he thinks can be done to encourage more children in programming :)

Build 2016 - Day 2

Onto Day 2 and the second keynote. Once again us marvellous students were given our special seating to the front of the keynote. Having started the conference with a flying start the day before, Day 2's keynote had big shoes to fill in terms of everything. And boy did they provide. Not far in and what were we gifted?

Why its only Xamarin of course! We already knew that Microsoft had recently acquisitioned Xamarin but the best part came when it was announced that it would be released free of charge to all Visual Studio customers. And when they say all Visual Studio customers they really mean it!! Even those who use Visual Studio Community, the free edition, would have access to the whole Xamarin platform which sent the crowd wild. As a student I don't think the news could've gotten any better. Though I personally use Visual Studio's Enterprise version there are a lot of students who use the Community version as they unable to gain access to paid versions. With this they are able to build apps for so many platforms without having to even pay a penny. The response I got from my peers at university was nothing short of amazing. Cries of joy and excitement and even a 'Darn why didn't I have this before I started my final year project...' I'm already decided to make use of Xamarin in mine. New technologies for the win! :D

Lots of cool and interesting stuff from Azure next with a never before seen use of Internet of Things...

I'm 'azure' that's a cool t-shirt.. Yeah? Yeah? Ok.....

We then had some cool videos and talks from the guys at both Accuweather and BMW. Accuweather are an American company that provide weather forecasting services across the world. They use Microsoft's Azure to provide more than 4 billion daily data requests using real time data. BMW made use of IoT to allow our friend David to integrate his digital info across multiple devices. In this case his home and his car. Now in terms of concept videos it couldn't have looked cooler. You wake up and your house helps you plan your day and route to work before you get in your car to find that your route that you just planned is already up and ready to go. You're driving along and your car warns you of rock slides and allows you to hold conference calls with someone somewhere else in world just before you sync calendars so you can meet up for lunch when you're next in town. Oh that's all while you're still driving on your way to work. I can't speak for everyone in the keynote but I would certainly love me one some of that tech...

Ooh Calicowind spotted in the keynote :D
We were then given a number of announcements in terms of mobile and data services found within azure. There was also some interesting additions to the azure portal and application insights that I'm looking forward to having a go with.

An all in all very good keynote though personally I would say it would have been tough to beat day 1's :P
Next on Calicowind's agenda was the second day of luncheon talks for students. However instead we were lucky enough to borrow some of Gabe Aul's time for an interview. Please read up in my following blog post about how that went :)

We were then straight off to our next interview with the lovely Craig Kitterman. We found him near the .NetRocks booth at the back of the expo hall and they were very keen to see what myself and my sister even going to say that they had heard of the 'girls running around with a camera'. They very kindly let us use their booth to record in and they were just so nice. From both myself and my sister we both want to say thanks for the Visual Studio socks!! Please read my upcoming blog post about how my interview with Craig Kitterman went :D

I saw some more great sessions run in the pop up theatres on topics such as a break down of the new IoT kit, creating your own smart bot and a really interesting one about Rendering Mars!!
Only one more day left I can't wait :D

Build 2016 - Day 1

So finally it was here. The glorious first day of Build. The start to what could only be something spectacular. We were lucky as students to be given special seating at the front and next to the journalists during the keynote. To ensure our seating we had to be there for 7:45. Which is fine. That's almost 4 in the afternoon in the UK and as a student about the time I get up anyway. The keynote hall was huge. Considering it had to seat thousands I'm not surprised...

We managed to get seats fairly close to the front compared to some. We were only about ten from the front. Funnily they seated all the students and Regional Directors together. I didn't mind though as it meant I could sit with my father through the keynotes. The keynote was excellent and fun to watch. Bryan Roper did an amazing piece on new parts coming to Windows 10 with inking and Cortana. Then we got the lovely announcement that every Xbox One would be able to be turned into a developer kit for free from that moment on.

Then it was Hololens news with the announcement that they would begin shipping dev units out. I'm just now biding my time until I can get my hands on one. Cool demos were shown on stage and students studying medicine showed how Hololens could be used to help their studies of anatomy and save on time understanding layouts of say the brain. I think that this is a fabulous use of technology. Yes its cool its fun its shiny but it is being used to make a difference in our society. Then Hololens and Nasa news which as a keen astronomer and programmer I would argue as one of the best parts. The announcement of Destination Mars had everyone excited and cheering. Especially as they walked through parts of how they did it, had Buzz Aldrin as a 3-D guide during the experience and that it would be available to have a go with at the Kennedy Space Centre from the summer.

I was thrilled when I tweeted out saying I couldn't wait to have a go and I got a reply from Kennedy Space Centre saying I should visit and have a go. Now it would be just plain rude to turn down such an offer. I just need to convince my parents to take me.....

More from Cortana with more bad (amazing) jokes.

Then it was all about those bots as we were introduced to these intelligent, machine learning pieces of software that are able to be embedded in any app that requires one. On stage we saw a demo of a pizza being ordered and sent out for delivery all through the use of bots. It was even able to be programmed and taught to understand slang words such as 'crib'. The most incredible part was when they showed this video. The applause and response from the crowd was outstanding. Microsoft have created something that can allow an otherwise allow a blind man to be able to see the world around him. Every single person left that keynote feeling pride in the fact that they worked with Microsoft and it really couldn't have set a better tone for the rest of the conference.

Us lucky students then had a lunch talk put on for us by Scott Hanselman whom last year I actually interviewed about the fun things around Build. He gave a delightful talk about what he does and some of the great things technology can do. Like a robot that can help you argue on the internet. I suppose leaves you to do other things? Students freebies in hand we headed to the exhibit hall to have a look around. Especially compared to last year there seemed to be so much. Whereas last year the exhibitors were spread out in the open spaces on every floor this year they were all in a large hall allowing you to explore. Towards the back of the hall they had set up mini stages that had people giving only 20 minute presentations on a variety of things. As I was running around meeting people I found this excellent as I could still catch some sessions.

I listened to some interesting sessions including one on Unity where the presenter game up and running in his thirty minute slot and one talking about the Windows Insider Program. Though seats were limited at these pop up theatres which meant you were usually standing or on the floor. Especially at the more popular ones.

I was then lucky enough to receive one of the golden tickets

Ok so its more of an orange but its close enough. Located at the back of the expo hall was the Hololens demo experience. Upon acquiring a ticket and arriving with plenty of time to spare just in case you join the back of a line to have a go at the Hololens demo, Destination Mars. When its finally your turn you get to watch a short intro video about what Destination Mars is about and how they got there. We went in the room in groups of eight and first had to measure the distance between our pupils to make sure that the experience was at its optimum for us. We were then taken to the Hololens where we then put them on. I must say I wasn't sure quite what to expect. I had some mild trouble regardless of help getting the device to not slip on my hair and to not occasionally knock my glasses forcing me to readjust both them and the Hololens. That aside once the device is on and secure, using a 3D model of Mars in the middle of the room to help you adjust the right place for your Hololens, you are lead into a large room where the experience really gets going. After a moment Buzz Aldrin pops out of one of the corners of the room talks to the group about Mars before exclaiming 'Lets go to Mars!' Where the landscape suddenly transforms into that of the red planet. He tells you to look around and see what you can see. The view with the Hololens is only actually about the size of a postcard so around the sides you are still able to see the room that you are in. As you move around though you are encouraged by Buzz to look out for any arrows that appear anywhere in your vision. Following the arrows lead you to an interesting part of the surface of Mars for you to learn more about. For example I was looking up at one point when an arrow appeared encouraging me to look at the ground around me. There the ground started to transform to show me how erosion had taken place on the surface with audio in my Hololens explaining what was going on. We moved to another area of Mars where we saw a to scale model of the curiosity rover and we got to hear more facts about that as well. The audio in the Hololens worked marvellously with it being loud enough that you could hear it very clearly but not so much that you could hear other peoples. After another couple of minutes the experience came to an end and we handed in our hololens. Darn... As I said before the Hololens for me kept slipping which meant after some use I started getting a mild headache but honestly I think I just needed to secure it better as my sister had no problems with hers at all. Besides that it was amazing to be able to explore Mars in the way I did. It was fun and just delightful to see how the Hololens has come along. I can only bide the time till I get to have another go. On the way out they also let you pose with the Hololens and send a photo of yourself. Needless to say we took full advantage of this....

The future looks bright and Hololensy from where we stand. Onto Day 2!!!