Created: January 2011
Last Updated: February 2011
Problems
Getting a 'FileNotFoundException' Error During Compilation.
Solution: This is due to Visual Studio not being able to find a content file belonging to your project, because Visual Studio manages a separate autonomous directory for running your application and searches for your files from this base directory. It may be the case that your files were not copies over to this location. Therefore, it is likely that you can fix this issue by simply right-clicking the file (that could not be found) from the Solution Explorer in Visual Studio, choose "Properties", and in the properties box, do one of the following options:
change the "Copy to Output Directory" value to "Copy if newer". Remark: This results in Visual Studio doing a raw copy of the original file into the managed directory.
change the "Build Action" value to "Compile". Remark: This compiles the content file into the more storage efficient XNB file. However, the automatically generated code files from Glue are not written to load from compiled files. Hence, this solution may not solve your problem if you decide to use the generated code files.
Remark: The two options are not mutually exclusive; hence, applying both options will bloat up the size of your compiled project (i.e. there will be both raw and compiled XNB files).
Visual Studio Does Not Publish the Content Files to the Specified Directory.
Solution: When you publish a project, Visual Studio also publishes a copy to another directory located at bin\x86\Debug or bin\x86\Release relative to your project directory (on a 64-bit operating system). Your contents and game executable will be published here. The reason that Visual Studio does not publish the contents to the directory you specified is probably because the XNB files are incompatible with your code; that is, your code is written to load raw content files rather than compiled content. This is likely due to the code found in the generated files from Glue, which is written to load raw content files.