I cannot compile any XNA tutorials

I have Microsoft Visual C# express and XNA Game Studio Express, but when I create a new project and follow the tutorial (any tutorial) and copy and paste the code into a new project, i cannot compile because there are errors when i press F5. Example in tutorial 1: displaying a 3d model on the screen i follow all the directions and when i copy and paste the code at the end and hit f5 i get the first error in this line:

myModel = content.Load<Model>("Content\\Models\\p1_wedge");

and i cannot continue. I have tried several tutorials in the past weeks and none run.

I need help for doing this for school. Thanks



Answer this question

I cannot compile any XNA tutorials

  • Programm3r

    If you did what I said the picture you want to display in your program should be on the right hand side of your screen, in the "Solution Explorer" window. Right click on your picture in that window, go to properties, then look for where it says "Asset Name". Put whatever Asset Name is where you have "Content\Models\p1_wedge" right now, and it should (hopefully) work.
  • zubziro

    I'm having the same problem. Where does the compiler look for the file it is trying to load I tried putting the image I wanted to load in every folder that dealt with my project, yet it never was able to find it.
  • Christopher A

    I copied the one file into the models folder and the other into textures as it explains in the tutorial. The first error is:

    Error loading "Content\Models\p1_wedge". File not found.


  • CTheSoup

    Something I noticed different from the tutorial picture is when it says:

    Your project structure should now look similar to this:

    The file p1_wedge.fbx does not look the same on my project; it looks like a file that has to "open with" ( not with the little blue picture in the center like in the tutorial). This is ridiculous!!!


  • AaronBrock

    _Fling_ wrote:
    I'm having the same problem. Where does the compiler look for the file it is trying to load

    The "Content\\Models" part of the string is the folder structure, which needs to be under the folder containing the project.



  • Craig Schaepe

    Hmm, I did what you said

    Project-->Add Existing Item-->Wherever your file is. And then voila it should work.

    But I am still getting the same error:

    Error loading "Content\Models\p1_wedge". File not found.


  • CesarDev10

    Did you add them to the project to make sure they were compiled into xnb files

  • Mateusz Rajca

    What is the error message, Have you copied the Models from the spacewar sample across.... You should have a directory in your project called content, and several models and textures that you should have coppied from the space war sample.



  • Ed Abshire

    That was it thanks. I'm used to just putting the image into the directory and then loading it that way, never thought of just adding it to the project. Thanks for the help. And in case the person who origionally posted this thread still needs help, this is what you do exactly.

    From the top bar:

    Project-->Add Existing Item-->Wherever your file is. And then voila it should work.


  • ShivaanKeldon

    You need to make sure that you ad the content files using the solution explorer... and do not copy them to the directory, let the IDE do that. If you have the content files in the correct directory under the solution explorer the IDE will take over and transfer the files to the output directories at the time you build the application. When it does this it will look at the files and change them into the format that is needed, if you do copy the files into the directory the compiler will not know what format they are or what it is supposed to do with them.



  • Aaron.W

    If you don't have a content\models folder structure under the project folder you need to change the code to wherever the file is.

  • I cannot compile any XNA tutorials