Saturday, February 5, 2011

How to get Surface 1.0 SP1 running on Win7 x64 and VS2010

I'm posting this "brain dump" from my research journal because it was a royal PITA. Maybe it can help someone else. The articles referenced in here hopscotch around in quite a tangled fashion. I empathize with the people who wrote these up... we all have the tendency to document the things we know about at the time we know them and then quickly go stale or have quirks. This post will be no different, but at least as of 2/5/2011, this tells devs new to Microsoft Surface 1.0 SP1 development how to proceed. I hope it can save some grief.

Twitter thanks to @GrumpyDev, @eNeRGy164, @surface, @sevensteps, @brianpeek, my friend @gaganrajpal, and Prof Holly Yango for her quickstart (

back to work. going to try to install the SDK again and get it working.
previously I had used Brian Peek’s instructions at but there are some slight variations here. @sevensteps advised that grumpydev was worked.

BULLETS mark steps I did.

from my 1/27 post:
GrumpyDev was identified as should work if I follow it to the letter, will try this weekend again:
  • use ORCA to remove the following keys from the MSI.
  • Select “LaunchCondition” in the left hand list, then select “Install OR NOT VersionNT64″. delete
  • select “InstallExecuteSequence” in the list on the left and remove SetCreateSqmMachineGuid and CreateSqmMachineGuid. delete

Followed this to the right after it says save and close ORCA part, but before installing flip over to these instructions to get orca edits for VS2010 as well:
  • Select “LaunchCondition” and:
  • Select the row with "Installed OR (VS2008SPLEVEL AND VS2008CSPROJSUPPORT) OR VCSEXP2008SPLEVEL" and choose "Drop row"
  • Select the row with "Installed OR (VS2008SPLEVEL AND VS2008SPLEVEL >= "#0") OR (VCSEXP2008SPLEVEL AND VCSEXP2008SPLEVEL >= "#0")" and choose "Drop row"
  • Select the row with "Installed OR DEXPLORE" and choose "Drop row"
  • Select the row with "Installed OR VS90DEVENV OR NOT VS2008SPLEVEL" and choose "Drop row"
  • Select the row with "Installed OR VCSHARP90EXPRESS OR NOT VCSEXP2008SPLEVEL" and choose "Drop row"

Now, continue from [] and:
  • Now you can quit Orca and run the msi, which should install just fine. Make sure you also switch off automatic updates and error reporting as follows...
  • done

Ok, the SDK is installed. Now, following the instructions it says to go to the original post and follow steps 2 & 3 (

  • changed step 1 to “open command prompt with Run as Admin”
    • cd “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC”
    • vcvarsall.bat
    • then:
  • Change to "C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Tools\Simulator".
  • Enter "corflags SurfaceSimulator.exe /32bit+ /force" (without the quotes). We need to use /force because the assemblies are strong named signed, and altering them this way will invalidate that signature. This is unfortunately unavoidable, but I haven’t found any problems from doing so. You will receive a CF011 warning informing you of this
  • Change to "C:\Program Files (x86)\Microsoft Surface\v1.0".
  • Use the same corflags syntax from step 3 on the following files, one by one:Attract.exe, AttractConfig.exe, SurfaceInput.exe, SurfaceOutOfOrder.exe,SurfaceShell.exe.
  • Close the command prompt and launch the simulator!

finished step 2. simulator appears to run. however closing it doesn’t shut it down. I had to go to the task explorer and kill the process tree for the simulator. still, this is a step in the right direction.

Now, on to step 3. but wait, I don’t have any projects yet. Ok, we’ll come back to this.

Going back to he explains in an update how to install the samples.

I had to do this:
  • goto C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Samples and unzip “Surface Code” into the same dir.
    • had to expand this to a different folder.
    • now follow his update:
  • Edit the configuration properties for the sample solution and create an x86 platform for all projects. (this is step3, haven’t done it yet)
  • - Edit InstallSamples.bat
  • - Comment out the lines on either side of the set as follows:
  • ::FOR /F “eol=H tokens=2*” %%A IN (‘REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Surface\v1.0 /v IsLogicalSurfaceUnit’) DO SET LogicalTableValue=%%B
  • SET InstallingOnTable=false
  • ::IF %LogicalTableValue%==0×1 SET InstallingOnTable=true
  • - Change the MSBuildParameters to reference the x86 PlatformName as follows:
  • SET MSBuildParameters=/p:Configuration=Release;PlatformName=x86 /noconsolelogger /fl /fileLoggerParameters:LogFile=%LogFile%;Append /nologo

ok, now I did:
  • run cmd as admin
    • cd “C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC”
    • vcvarsall.bat
  • cd (where I unzipped the files)
  • InstallSamples.bat

“Successfully installed...”
“Please run the Surface Simulator to browse sample applications from the Surface Shell Application launcher”

Hmmm, wonder what that is? oh!! just running the simulator now has a bunch of apps in it. Ok, there must be a directory or database where the samples got “installed” to in order to run in the simulator...

Hmm however none of the samples actually run when I open them -- timeout. Hmmm.

Wait, maybe the XNA stuff isn’t installed?
Reading this:

Nope, I had already done this, tried uninstalling and reinstalling. no dice.

Ok, what about this? I noticed that grumpydev step 2, substep 5 was missing this file:
this is mentioned at
so I’m doing this from that dir:
  • CorFlags setupcustomaction.exe /32BIT+ /Force /nologo

Still no dice... everytime I launch a sample, it starts up, I click something and get “ControlsBox has stopped working” -- or similar depending on the sample.

Ok, forget the samples. Let’s go back to the instructions for installing the solution templates:

xcopy /s "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ItemTemplates\CSharp\Surface\v1.0" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Surface\1033\"
xcopy /s "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\CSharp\Surface\v1.0" "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Surface\1033\"

ok, that was bunk. those dirs don’t exist on my system. I think he meant:

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\VCSExpress\ItemTemplates\CSharp\Surface\v1.0

which did exist... but hmmm, there is also...

C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Project Templates


Wait, hold on, the target directory already exists too!!:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Surface\1033

each of these dirs has different files. GOOD GRIEF!!

Ok, let’s just try running the last two commands and see if VS2010 recognizes the two templates installed in VS 10.0 dir above.
  • cd "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE"
  • devenv /setup

Ok, after it completed it picked up the two installed templates in the VS2010. Good! To see this:
  • Open VS2010 and go to “New Project”
  • expand “Other Languages/Visual C#/Surface”. See:
    • “Surface Application (WPF)”
    • “Surface Application (XNA)”

NOTE: says:
The Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5 is not required. However, if you want to develop Microsoft Surface applications by using Windows APIs, you must install the Windows SDK for Windows Server 2008 and .NET Framework 3.5.
(I already had installed Windows SDK (not server 2008) and .NET 3.5 previously).

ALSO NOTE from the same loc:
The Microsoft Surface SDK does include project templates for XNA 3.0, but it does not include XNA 3.0 components. If you want to develop Microsoft Surface applications by using XNA 3.0, install Microsoft XNA Game Studio 3.0. When you want to deploy a Microsoft Surface application that uses XNA 3.0, install Microsoft XNA Framework Redistributable 3.0 on all Microsoft Surface units that will run the application.
(I had installed the XNA Game Studio 3.0 previously).

Note that also states you MUST select .NET 3.5 when creating the project from the template.
  • make sure .NET Framework 3.5 is selected at the top
  • I want the XNA template, so I click that, fillin the name, location and OK.

Horray, now I have a solution template filled in. now I can go back to step 3 of

I had to adapt these directions...
  • right click the solution and select “Configuration Manager...”
  • set “Active Solution configuration” to Debug
    • from “Active solution platform” select “New...”
    • select “x86” and OK.
  • make sure that “Platform” in the list below is set to x86.
  • set “Active Solution configuration” to Release
  • select x86.
  • make sure that “Platform” in the list below is set to x86.
  • close.

Now, I wonder if we can get this to run in the surface simulator?
  • run the surfacesimulator first
  • then hit debug in the project.

Ok, that seemed to launch the blank XNA template in the simulator... so far, so good.

Let’s see if something works... found this quick start:

changing the sprite to “Resources\icon.png” (which already existed in the template) worked... I get the icon in the middle of the display.


Ok, next up, time to dig into XNA and see about graphics, and shaders, etc. I may start with simple particle sims.

No comments: