I am writing game in XNA 4 and this version have two profiles hi-def and reach. My problem is that I need to have my game code for each of these profiles and is very uncomfortable to have two projects and do all changes in both of them. My idea was to use preprocessor directive (i am not sure about name of this, http://msdn.microsoft.com/en-us/library/ed8yd1ha%28v=vs.71%29.aspx) and use IF statement at places with problems with profile. There is only problem that program needs to be compiled two times (for each profile) and manually changed directive and project settings to another profile. And my questions are: Is that good way? Is there better and cleaner way how to do this?
I got this working, but you need to use some MSBuild magic to do it. I strongly recommend you backup your project, as you might easily break something if you do this wrong.
First things first, you need to open up the configuration manager(
Then you need to create four build configurations for your game project. I chose to name mine
After doing this, you save your project, right-click the project in the solution explorer and then hit
In the first
After that, you save the file, close it, then right-click the project and click reload. Now depending on the build configuration you use, you'll either use Debug or HiDef. Please note that opening up
You can see a working example here, where the window title changes to show what XNA profile was set.