C# – XNA 4.0 with C# .NET 4.5

.net-4.5cnetvisual studio 2012xna

I want to write an XNA game using .NET 4.5, so that I can use one of the new features that isn't in .NET 4.0.

Is there any way to do this? VS2012 doesn't have XNA listed anywhere in the list of New Projects.

I have also seen this question:
How to install XNA game studio on Visual Studio 2012?

But I'm only a hobbyist and I couldn't get xcopy to work (plus I don't think I have the game studio, only the framework). I was wondering if it was possible to instead target .NET 4.5 in VS2010, anyway.

Thanks in advance.

Best Answer

You can change the project file of a XNA game to let it use .Net 4.5. Open the .csproj file and change the following lines:

<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>

to read:

<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

and on the next compile the binary is .Net 4.5. At our company we use it to create XNA games with the new Kinect One and it works splendidly. We tried MonoGame and although its great it was not as stable as we hoped on Windows in our specific case.