1
votes

I've been trying to use XNA framework along with Visual Studio 2012. Since the xna framework is not yet compatible with Visual Studio 2012 I had to set it manualy. Yet, I managed to succesfully import xna references and create default game methods allowing me to run my program.

The problem came when I tried to add texture to my project and load it. I manually created a "Content" folder in which I added my textures following msdn documentation at http://msdn.microsoft.com/en-US/library/bb313966(v=xnagamestudio.30).aspx

The problem is, since it's not XNA game project I wont have the properties window showing my texture file as a texture but just as a resource file. And the following code:

Load<Texture2D>("GrassTexture");

Will systematically lead to an error file not found. I've set my ContentManger as it follows:

ContentManager.RootDirectory = "Content";

Does anyone know how to properly set the content folder ?

1
I'm pretty sure just placing your file in a folder and hoping it will load will not be enough. The file has to go through the content pipeline, which is the main reason of this kind of project. Have you copied that aswell?dowhilefor
Load<Texture2D>("GrassTexture"); would usually work in XNA, assuming that the full line is 'Texture = Content.Load<Texture2D>("GrassTexture");' - Have you tried using a more complete filepath?Kobunite
I don't really know how to manually add the content pipeline, I assumed it was just a folder and there was some bindings to define in csproj file. But did not find out how to.Marc
Yes, of course, I tried a lot of absolute and/or relative paths, using extension, no extension, with everytime the same error.Marc
Just to say, I don't think the XNA framework is ever going to be compatible with Visual Studio 2012, I think Microsoft have killed it offJMK

1 Answers

0
votes

I had this problem too, but there is a opportunity to enable the xna game project for vs 12. Look here: https://stackoverflow.com/a/10881007/1780038