How to install Surface SDK 1.0 SP1 on Windows 7 64 bit and Visual Studio 2010

Suppose a customer asks you to update that wonderful Surface v1 application you wrote ages ago, but you don’t have the SDK installed on your new development machine running Windows 7 64 bit and Visual Studio 2010, you might have a problem, since the SDK cannot be installed. Bummer. But the change has to be deployed tomorrow! Don’t panic, read on. Let me guide you through 15 steps. Let me remind you that this procedure is not at all supported by Microsoft, but it works. And that’s the most important part.

UPDATE: 15/12/2011: Thanks to Florian Haag for the corrections and suggestions. However he’s still struggling with a very annoying bug. Perhaps you can help him out.

1. Relax

The steps are not at all difficult, but you have to remain focussed. Have a coffee, a tea, a fresh pint of beer.

2. Prerequisites

Make sure these are installed:

and you have the Surface SDK 1.0 SP1 file (SurfaceSDKWE.msi) somewhere on your computer.

Create a temporary directory where you will put all the edited files, let’s say c:\Surface.

3. Extract Surface SDK Files

Start the Visual Studio Command prompt with admin privileges and go to the directory where SurfaceSDKWE.msi file is located.

Execute following command in the command window:

msiexec /a SurfaceSDKWE.msi /qb TARGETDIR=c:\surface

Make sure you replace c:\surface with the directory name you created in the previous step. This directory will now contain all installation files.

4. Download Windows 7.0 SDK

Download the Windows 7.0 SDK Web installer. We need to use orca (to patch the surface installer) and corflags (to patch the surface executables).

Important: You need to download Windows 7.0 SDK since this one is working with .Net 3.5. Do not use Windows 7.1 SDK since that one is using .Net 4.0.

04_01 - download Orca

Make sure you check the option .Net development tools.

5. Install Orca

Install Orca. The installer file is located in C:\Program Files\Microsoft SDKs\Windows\V7.0\bin

05_01 - Install Orca

6. Patch msi file

Start Orca and open the SurfaceSDKWE.msi file from the c:\surface directory.

Go to Launch conditions in the left navigation.

06_01 - Remove settings

Make sure you select all highlighted entries, then choose Tables->Drop Row(s) from the menu.

06_02 - Remove settings

Close Orca and save the changes.

7. Patch setupcustomaction.exe

Open the Windows 7 x64 DEBUG Build Environment command prompt (with admin privileges) that has been installed as part of the Windows 7 SDK. It is labeld CMD Shell in the SDK’s start menu folder.

Change the current directory to c:\surface\Microsoft Surface\v1.0 and execute the corflags command:

corflags setupcustomaction.exe /32bit+ /force /nologo

07_01 - corflags

You will receive a warning that you can ignore.

07_02 - corflags

8. Install the Surface SDK

Now, it is time to install the SDK like you would on the original machine configuration.

08_01 - install surface sdk 1.0

9. Patch the executables

In order to run the Surface executables on your 64bit system, you need to patch them with corflags. Execute these commands in the Windows 7 x64 DEBUG Build Environment command prompt with admin privileges (CMD Shell in the SDK’s start menu folder):

cd “C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Tools\GenTag”

for %i in (*.exe) do CorFlags %i /32BIT+ /Force /nologo /UpgradeCLRHeader

cd “C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Tools\Simulator”

for %i in (*.exe) do CorFlags %i /32BIT+ /Force /nologo /UpgradeCLRHeader

cd “C:\Program Files (x86)\Microsoft SDKs\Surface\v1.0\Tools\SurfaceStress”

for %i in (*.exe) do CorFlags %i /32BIT+ /Force /nologo

cd “C:\Program Files (x86)\Microsoft Surface\v1.0”

for %i in (*.exe) do CorFlags %i /32BIT+ /Force /nologo

10. Verify: Surface Simulator

If all went well, you will now be able to start the Surface Simulator.

10_01 - test simulator

11. Copy the VS 2010 templates

The Surface project and item templates are only installed for Visual Studio 2008, so you have to copy them to the appropriate directory.

You will find the original templates in the directory c:\Program Files (x86)\Microsoft SDKs\Surface\v1.0

11-01 - kopieer templates

Copy the contents of the Item Templates directory to c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ItemTemplates\CSharp\Surface\1033

Copy the contents of the Project Templates directory to c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ProjectTemplates\CSharp\Surface\1033

12. Register the templates

Execute the following command in the command prompt (with admin privileges):

“c:\program files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe” /setup

13. Create a new Surface project in VS 2010

Open Visual Studio 2010, create a new project, but make sure you select “Surface” from the left navigation panel (and not the subdirectory v2.0) and .Net Framework 3.5

13_01 - visual studio

14. Alter the platform target

Make sure you alter the platform target of the project to x86. Believe me, you will forget!

14_01 - output x86

As Florian Haag mentioned in his comment, you could alter this in the project template. This way, you only have to change this once.

15. Build and enjoy the work

That’s it. You have performed all necessary steps. Step 13 & 14 must be repeated for every project.

Tags: , , , ,
Rubriek: Multitouch, Surface, WPF

6 reacties op “How to install Surface SDK 1.0 SP1 on Windows 7 64 bit and Visual Studio 2010”

  1. Lee zegt:

    This is great, but how do you install Surface SDK 1.0 SP1 on Windows 7 32 bit and Visual Studio 2010 as it doesn’t seem to work with my 32 bit Win 7 🙁 I don’t get any templates appearing in VS2010



  2. Florian Haag zegt:

    Hi there,
    thanks a lot for this tutorial. It did work for me on Win 7 64 Bit, however I have some remarks:

    In step 7 (and possibly others further down), it would be helpful if you could mention that the “Windows 7 x64 DEBUG Build Environment command prompt” is labeled “CMD Shell” in the SDK’s start menu folder. After using the Visual Studio command prompt right before, of which there are several versions so the correct title is important, it’s not evident that the “Windows 7 x64 DEBUG Build Environment command prompt” is just *any command prompt found in the Windows SDK 7.0 folder*.

    Even though it eventually wouldn’t do any harm, I’d have liked to be reassured that there’ll be more corflags warnings like the one from step 7 when running the commands for step 9, which can be safely ignored.

    Some troubleshooting: When I (thought I) had first completed the steps up to step 9, I tried to run the simulator, but I’d invariably end up with the following error messages:

    “Surface-Eingabe kann die in der Registrierung konfigurierten Filterassemblys nicht laden. Stellen Sie sicher, dass die Pfade zu den Filterassemblys korrekt angegeben sind. Weitere Informationen zum Fehler finden Sie in den Anwendungsereignisprotokollen im Pfad Microsoft-Surface-VisionSystem/Operational.”

    (possibly a translation of “Surface Input was unable to load the filter graph specified. Make sure the filter graph is correctly specified, and that all calibration data is valid.”, though it doesn’t quite say the same.)
    and then:

    “A communication error occurred during initialization. Please reinstall Surface SDK.”

    I realized that this was due to the wrong Windows SDK version installed. Your tutorial talks about SDK version 7.0, and SDK version 7.1 was installed on my machine already. Hence, I thought that it’s just a little bit more recent by a minor version number, probably just having some bugfixes over 7.0, so I just proceeded.
    The truth seems to be, however, that the difference between 7.0 and 7.1 is crucial. 7.0 is bundled with the .NET SDK 3.5 and 7.1 with the .NET SDK 4.0, but the Surface SDK requires the .NET SDK 3.5.

    So, after installing the correct Windows SDK version (in addition to the SDK 7.1) and reinstalling the Surface SDK, I could run the simulator as described in step 10.
    However, it seems quite buggy to me. I haven’t yet been able to solve this problem and I’m grateful for any hint. This is what the simulator looks like on my computer:

    As you can see, the surface simulation covers only about 4/5 of the client area of the simulator window. What makes this really severe is that simulated touch input is still mapped based on the actual window size. That is, in order to activate the button in the bottom right corner of the surface simulation, I have to click the bottom left corner of the simulator window. The closer I get to the top left corner of the simulation, the more closely clicked position and simulated touch position match.
    What’s more, the exit and minimize buttons in the title bar do not work. They just don’t do anything. My only way to gracefully close the simulator is via the context menu for the simulator’s task bar button.

    Ignoring these problems for now, I went on with the instructions and noticed that the paths indicated in step 11 contain a directory named “Common 7”. After unsuccessfully copying and pasting that path into my Explorer address bar, I realized that at least in my Visual Studio installation, that is actually “Common7” (without a whitespace).

    Lastly, step 14 and 15 imply that for every Surface project created based on those templates, the target platform has to be manually changed to x86. Shouldn’t it be possible to modify the templates so they always pre-set the required values? After all, that’s what templates are there for.

    Thanks again – and please let me know if anyone has a hint on how to fix that simulator scaling bug 🙂

  3. jim zegt:

    Thanks, Florian, for your extensive comment. I updated the article with your suggestions.
    I’m sorry, but I have no idea why you have this resize problem. I couldn’t reproduce this on my installations.

  4. Vincent zegt:

    Will the steps taken in this tutorial also work with Windows 7 and Visual studio 2008… I have recently inherited the task of developing on an an old school surface at my university… This said, I am having trouble patching the old SDK through…. I would appreciate any help that you can offer…

  5. Leen zegt:

    Great article! it worked well, just had to read it better to avoid mistakes 😉

  6. Shaad zegt:

    good explaination i followed all the steps which are mentioned but at the end when i am trying to run the simulator it’s says that the simulator screen resoultion not met even though monitor screen resolution is set to 1366 X 786…also visual studio 2010 not showing the surface sdk.