Tag Archives : SDK


Windows Phone 8 SDK finally released

As the BUILD conference (formerly PDC) kicks off in Redmond, we are finally treated to the official launch of the long, long awaited Windows Phone 8 SDK.

Held under wraps for months, with precious few copies of the pre-release being seen, this SDK has been a long time coming.  The only way to get an early look at the unfinished SDK was through hard core NDA agreements, and even these were strictly limited.  One copy leaked onto the Internet, but it was extremely early and offered very few insights into the platform itself.

The official reason for delaying the SDK?  It was held back due to sensitivities around “unannounced features” in the Windows Phone 8 platform (which the SDK ROM image would give away).  At any rate, from today we all finally get a look in at what the future holds for apps development on the new Windows phone platform.

To jump straight into the SDK, check out the What’s new page on MSDN.  If, for some weird reason, you’d prefer to read some marketing hype around the platform, perhaps have a read over here at the Windows phone site.

Finally.. Download the SDK


Introduction to the Windows Phone 8 SDK Developer Preview (Part 1)

Well it’s been leaked onto the world wide web for a bit over a week now, and I’ve finally managed to devote some time to taking a look at what’s been included in the leaked SDK.

Although we’ve been waiting for what seems like forever to see something of the new, highly anticipated Windows Phone 8 platform, the key to the puzzle – the SDK – has eluded the Microsoft developer community for a long time.  No longer!

Some notes up front:

  1. The SDK will only unpack and install on Windows 8 (Release Candidate, and presumably on the RTM next week) – no support for Windows 7!
  2. The SDK requires Windows 8 as it relies on the next generation hypervisor technology (the same as Windows Server 2012) which requires SLAT (second level address translation) support from the computer’s CPU.
  3. Whilst you may install the SDK on a computer which does not support Hyper-V and SLAT, you won’t be able to run the Windows Phone 8 emulator.

    finished

  4. You don’t need Visual Studio pre-installed.  The SDK ships with the Visual Studio 2012 IDE included, but will only support Phone development (none of the advantages of the full Visual Studio, obviously).

That leaves us with developing for Windows (formerly named Metro) 8 Style UI applications, which we’ve been told will run without any changes on the Windows Phone 8 platform.

That’s a fair bit of trust..  In the meantime, I need to find a machine with a newish CPU (one that supports SLAT).  So there will be more to come – stay tuned.  Next article, I’ll take a look at the Developer licensing and what comes included in the SDK.


Automating Visual Studio 2010 – Part 1

Now for something completely different.  Recently I had the desire to build a Visual Studio 2010 solution file for a number of project files under a directory.  There were many projects, and each one linked to a solution file – but I wanted a “master” solution file.. one to rule them all(?)

Generally, I hate manual repetitious tasks, and laboriously adding all the projects to a  new, blank, solution file seemed tedious and not fun one bit.  Then I decided that I’d write a program which would iterate all the projects and create a solution file for me.  Sounds simple enough, right?

Well, it took me on a journey into Visual Studio automation.  There are many facets of working with VS, as I found out, and backwards compatibility reigns supreme.  What I’m going to introduce you to is pretty much just for Visual Studio 2010, but in the right hands a design could come which supports versions dating back to Visual Studio 2005.

The Prerequisites

Optional Extras

Once you’ve got your system all nicely configured, we’re ready to begin.

The Beginning

To begin with, I created a Class Library.  My intention was to create a large amount of nice, reusable automation for integration into Team Build, utilities and so forth.  You never know when this is going to be very, very handy.

To start our journey, I decided that my requirement was going to be very simple (for Part 1): create a blank solution file using Visual Studio 2010.  Easy enough, right?  Well, as you’d expect, the devil is in the details.  This took me quite a bit of time to get right, but in the end the outcome was most pleasing.

So open up Visual Studio, create a project type you’d prefer and then ready the project, as so:

  1. Add a reference
  2. Pick the COM tab
  3. Scroll and select “Microsoft Development Environment 10.0”
  4. This will add several COM interop assemblies to your project (and also include the previous versions)
  5. Click on the .Net tab and select “Microsoft.VisualBasic” (even if you aren’t coding in Visual Basic)

image image

Now it is time to go code us up a simple solution.  I’m going to be working on a far more robust library, but in the meantime this will introduce you to the extremely powerful DTE and DTE2 objects.

We have to (sadly) instantiate a COM object wrapper, which will actually load devenv in a non-interactive mode, from which we can then cherry pick functionality we’d like to use.  For this demo, we’re just going to create a Visual Studio 2010 compatible solution file.

Consider the following very simple class:

namespace VSAutomation.Toolkit
{
    public static class SolutionHelper
    {
        public static void CreateSolution(string path, string solutionName)
        {
            DTE2 dte2 = (DTE2)Microsoft.VisualBasic.Interaction.CreateObject("VisualStudio.DTE.10.0", "");
            Solution4 solutionObject = (Solution4)dte2.Solution;
            solutionObject.Create(path, solutionName);
            solutionObject.Close(true);
        }
    }
}

You will notice that we create a COM object instance using the VisualBasic namespace.  When the code actually creates the object, under the hood, the machine will see an instance of Visual Studio created (but no GUI):

image

Once it is loaded, we can get access to the VS Solution functionality.  From here, it is a simple matter of supplying the path and solution name (omit the .sln extension) and, assuming all goes to plan, you will have the following output:

image

Obviously this is just the tip of the iceberg. 

We have so much powerful functionality to exploit, so we won’t stop at this.  Since we’ve achieved our objective for Part 1, we’ll wrap up here, but check back for Part 2 where we’ll populate the solution file with existing (or new) projects!

In the next part, we’ll also discuss ways of supporting the older versions (Visual Studio 2008 and 2005) as well as providing a more verbose sample.


Further Reading

How to: Get References to the DTE and DTE2 Objects

Solution4.Create Method (String, String)