XNA Creators Club Online
Page 1 of 1 (5 items)
Sort Posts: Previous Next

XNA2.0: A .png file won't build into a .xnb file.

Last post 16/04/2009 7:15 by Kriosym. 4 replies.
  • 24/07/2008 4:08

    XNA2.0: A .png file won't build into a .xnb file.

    I have a .png file placed in a subdirectory of my Content folder.   When I run and build the project, a .xnb file is not appearing in the x86/Debug/Content/Sprites/ folder.  I have tried deleting the Debug build, building it again, rebuilding it, etc.  All the old files will rebuild as desired, but the new one won't.
    I have tried many things, and have concluded that new .png files added to the project aren't building to .xnb files.  I have never run into this problem before, and have spent a ton of time trying to find out what I did to make them not load.  Hopefully someone can help me with this problem.

    Here are some specifics for the file:
    Build Action: Content
    Copy to Output Directory: Do Not Copy
    No custom tools.

    This could very well be a simple oversight or something a changed, but I have spent a ton of time trying to figure out why it won't work all of a sudden.  If anyone could help that would be great.

  • 24/07/2008 4:12 In reply to

    Re: XNA2.0: A .png file won't build into a .xnb file.

    Are you getting an error when you run the project that it can't find the file? I'm just curious if maybe you've switched your build to "release" instead of "debug" so it's in the other folder structure.
  • 24/07/2008 4:24 In reply to

    Re: XNA2.0: A .png file won't build into a .xnb file.

    George Clingerman:
    Are you getting an error when you run the project that it can't find the file? I'm just curious if maybe you've switched your build to "release" instead of "debug" so it's in the other folder structure.

    Yes, I get the exception during runtime ("ContentLoadException").  I've tried it in both Debug and Release builds but in each build folder the file is never built, and the content is included in the project in the solution explorer pane. 

    I just opened another project and repeated my steps for adding the .png file and it built and ran fine.  Is there anyway I could have told my solution to prevent new content from being built?

  • 24/07/2008 4:44 In reply to

    Re: XNA2.0: A .png file won't build into a .xnb file.

    I just needed to take a step back.  I found the problem, stupid thing I kept looking over.  Thanks for your time, I appreciate it!
  • 16/04/2009 7:15 In reply to

    Re: XNA2.0: A .png file won't build into a .xnb file.

    I had the same problem. Evidently I had added my Content Folder incorrectly. There were two content folders, one was the real one, and one was a mock added one with my textures inside of it, and no matter how much I included it into the solution, the system would not find or build it. So I deleted it, went to the proper content folder and added the Textures folder there instead, and then the .png file. I noticed the properties of the PNG were much more complete now, and sure enough it worked.
Page 1 of 1 (5 items) Previous Next