Including Microsoft.XNA.Framework.Input.Touch in a project?

So after running through tutorials by both Microsoft and www.xnadevelopment.com I feel very confident in my ability to get to work on my first game using the XNA Framework. I've manipulated sprites, added audio, changed game states, and even went a step further to apply the knowledge I had and figure out how to make animations and basic 2-dimensional physics (including impulses, force, acceleration, and speed calculations)

But then shortly into the project I hit a curious bump that I've been unable to figure out.

In wanting to implement menus, pause screens, and several different aspects of play (a "pre-level" prep screen, the level itself, and a screen after the level to review how well you did) I took a look at Microsoft's Game State Management sample. I understood the concept, although it was admittedly quite a lot to take in. Not wanting to recreate the entire concept by scratch (after all- what purpose would that serve?) I tried copying and pasting the sample code into my own ScreenManager class (as well as InputState and GameScreen classes) to try and borrow their ingenuity. When I did this, however, my project stopped compiling. I was getting the following error:

The type or namespace name 'Touch' does not exist in the namespace 'Microsoft.Xna.Framework.Input' (are you missing an assembly reference?)

Having read through their sample code already, I realized that this namespace and every function and class within it could be safely ripped from the code without losing functionality. It's a namespace simply for integrating with touchscreen devices (presumably Windows Phone 7, but maybe also tablets).

But then I began to wonder- how come Microsoft's sample compiled but mine didn't? I copied their code exactly so there must be a setting somewhere that I need to change in Visual Studio in order to correct this. I tried creating a new project as a Windows Phone 7 game rather than a Windows game, however that only forced it to compile to a Windows Phone emulator and denied me the ability to change the resolution and other features which I clearly had the power to do in the sample code.

So my question is simple - how do I properly use the namespace Microsoft.XNA.Framework.Input.Touch?

• Did you download the right version for your expected use, that is, Windows/Xbox or Windows Phone? I noticed that there was two separate samples of the tutorials respectively. I just compiled using VS2010 and I had not to remove or modify any of the namespaces. – Will Marcouiller Mar 8 '11 at 0:01
• I did download the "WIN XBOX" version, however if you'll look at ScreenManager.cs then you'll notice at the top it has the line using Microsoft.XNA.Framework.Input.Touch. Even though it's not intended for use on Windows Phone 7, it still has support for touchscreen gestures (possibly for tablets running Windows 7?) – stevendesu Mar 8 '11 at 0:14
• +1 Interesting, I imported the ScreenManager classes and the Screens classes to my test game project, and I encounter the same as mentioned in your question. Working on it now! =) – Will Marcouiller Mar 8 '11 at 0:20
• Had you tried to add the reference to within your project? After having added the Microsoft.Xna.Framework.Input.Touch reference to my project, it compiled fine. – Will Marcouiller Mar 8 '11 at 0:48
• From within Visual Studio, right-click on your project and then Add|Reference, click the .NET tab if it isn't active, then select the Microsoft.Xna.Framework.Input.Touch assembly, it will correct no longer annoy you with the error about "missing reference". – Will Marcouiller Mar 8 '11 at 2:49