# How do I stop XNA/Visual Studio from rebuilding my content project every time I build?

My group and I are working on a game in XNA 4.0 with Visual Studio 2010/2012. The main solution has 6 projects: 2 XNA game projects (1 executable/ 1 class library), 1 WPF executable for the level editor, 2 standard class libraries, and a content project. Originally, the editor and engine XNA game projects had a content reference to separate content projects. Recently, I consolidated the content projects into one to simplify asset additions. Since pushing these changes to our git repo, certain members of my group have been experiencing weird build issues. Every time they run the project, they have to re-build all of the assets. This happens regardless of whether any changes were made, even if they just run the project directly after building. I've taken a few steps to figure out why this is happening. Below is the MSBuild output set on Normal verbosity.

The seemingly important part is at 4, with the line
4> Rebuilding all content because build settings have changed

1>------ Build started: Project: Engine.Core, Configuration: Debug x86 ------
1>Build started 11/29/2012 3:24:24 AM.
1>ResolveAssemblyReferences:
1>  A TargetFramework profile exclusion list will be generated.
1>EmbedXnaFrameworkRuntimeProfile:
1>Skipping target "EmbedXnaFrameworkRuntimeProfile" because all output files are up-to-date with respect to the input files.
1>GenerateTargetFrameworkMonikerAttribute:
1>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
1>CoreCompile:
1>Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
1>XnaWriteCacheFile:
1>Skipping target "XnaWriteCacheFile" because all output files are up-to-date with respect to the input files.
1>_CopyOutOfDateSourceItemsToOutputDirectoryAlways:
1>  Copying file from "<solution-dir>\src\Engine.Core\DialoguePrototypeTestDB.s3db" to "bin\x86\Debug\DialoguePrototypeTestDB.s3db".
1>_CopyAppConfigFile:
1>Skipping target "_CopyAppConfigFile" because all output files are up-to-date with respect to the input files.
1>CopyFilesToOutputDirectory:
1>  Engine.Core -> <solution-dir>\src\Engine.Core\bin\x86\Debug\TimeSink.Engine.Core.dll
1>
1>Build succeeded.
1>
1>Time Elapsed 00:00:00.13
2>------ Build started: Project: TimeSink.Entities, Configuration: Debug x86 ------
2>Build started 11/29/2012 3:24:25 AM.
2>ResolveAssemblyReferences:
2>  A TargetFramework profile exclusion list will be generated.
2>EmbedXnaFrameworkRuntimeProfile:
2>Skipping target "EmbedXnaFrameworkRuntimeProfile" because all output files are up-to-date with respect to the input files.
2>GenerateTargetFrameworkMonikerAttribute:
2>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
2>CoreCompile:
2>Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
2>XnaWriteCacheFile:
2>Skipping target "XnaWriteCacheFile" because all output files are up-to-date with respect to the input files.
2>_CopyOutOfDateSourceItemsToOutputDirectoryAlways:
2>  Copying file from "<solution-dir>\src\Engine.Core\DialoguePrototypeTestDB.s3db" to "bin\x86\Debug\DialoguePrototypeTestDB.s3db".
2>CopyFilesToOutputDirectory:
2>  TimeSink.Entities -> <solution-dir>\src\TimeSink.Entities\bin\x86\Debug\TimeSink.Entities.dll
2>
2>Build succeeded.
2>
2>Time Elapsed 00:00:00.11
3>------ Build started: Project: Editor (Editor\Editor), Configuration: Debug x86 ------
4>------ Build started: Project: Engine.Game, Configuration: Debug x86 ------
3>Build started 11/29/2012 3:24:25 AM.
3>CoreCompile:
3>  All content is already up to date
3>ResolveAssemblyReferences:
3>  A TargetFramework profile exclusion list will be generated.
3>EmbedXnaFrameworkRuntimeProfile:
3>Skipping target "EmbedXnaFrameworkRuntimeProfile" because all output files are up-to-date with respect to the input files.
3>GenerateTargetFrameworkMonikerAttribute:
3>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
3>CoreCompile:
3>Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
3>XnaWriteCacheFile:
3>Skipping target "XnaWriteCacheFile" because all output files are up-to-date with respect to the input files.
3>_CopyOutOfDateSourceItemsToOutputDirectoryAlways:
3>  Copying file from "<solution-dir>\src\Engine.Core\DialoguePrototypeTestDB.s3db" to "bin\x86\Debug\DialoguePrototypeTestDB.s3db".
3>_CopyOutOfDateNestedContentItemsToOutputDirectory:
3>Skipping target "_CopyOutOfDateNestedContentItemsToOutputDirectory" because all output files are up-to-date with respect to the input files.
3>CopyFilesToOutputDirectory:
3>  Editor -> <solution-dir>\src\Editor\Editor\bin\x86\Debug\Editor.dll
3>
3>Build succeeded.
3>
3>Time Elapsed 00:00:00.39
4>Build started 11/29/2012 3:24:25 AM.
4>CoreCompile:
4>  Rebuilding all content because build settings have changed
4>  Building Textures\circle.png -> <solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\Content\Textures\circle.xnb
4>  Importing Textures\circle.png with Microsoft.Xna.Framework.Content.Pipeline.TextureImporter
4>  Processing Textures\circle.png with Microsoft.Xna.Framework.Content.Pipeline.Processors.TextureProcessor
4>  Compiling <solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\Content\Textures\circle.xnb
4>  Building Textures\giroux.png -> <solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\Content\Textures\giroux.xnb
4>  Importing Textures\giroux.png with Microsoft.Xna.Framework.Content.Pipeline.TextureImporter
4>  Processing Textures\giroux.png with Microsoft.Xna.Framework.Content.Pipeline.Processors.TextureProcessor
4>  Compiling <solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\Content\Textures\giroux.xnb
4>  Building Textures\Body_Neutral.png -> <solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\Content\Textures\Body_Neutral.xnb
4>  Importing Textures\Body_Neutral.png with Microsoft.Xna.Framework.Content.Pipeline.TextureImporter
4>  Processing Textures\Body_Neutral.png with Microsoft.Xna.Framework.Content.Pipeline.Processors.TextureProcessor
4>  Compiling <solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\Content\Textures\Body_Neutral.xnb
4>  Building font.spritefont -> <solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\Content\font.xnb
4>  Importing font.spritefont with Microsoft.Xna.Framework.Content.Pipeline.FontDescriptionImporter
4>  Processing font.spritefont with Microsoft.Xna.Framework.Content.Pipeline.Processors.FontDescriptionProcessor
4>  Compiling <solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\Content\font.xnb
4>ResolveAssemblyReferences:
4>  A TargetFramework profile exclusion list will be generated.
4>EmbedXnaFrameworkRuntimeProfile:
4>Skipping target "EmbedXnaFrameworkRuntimeProfile" because all output files are up-to-date with respect to the input files.
4>GenerateTargetFrameworkMonikerAttribute:
4>Skipping target "GenerateTargetFrameworkMonikerAttribute" because all output files are up-to-date with respect to the input files.
4>CoreCompile:
4>Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
4>_CopyOutOfDateSourceItemsToOutputDirectoryAlways:
4>  Copying file from "<solution-dir>\src\Engine.Core\DialoguePrototypeTestDB.s3db" to "bin\x86\Debug\DialoguePrototypeTestDB.s3db".
4>_CopyOutOfDateNestedContentItemsToOutputDirectory:
4>Skipping target "_CopyOutOfDateNestedContentItemsToOutputDirectory" because all output files are up-to-date with respect to the input files.
4>_CopyAppConfigFile:
4>Skipping target "_CopyAppConfigFile" because all output files are up-to-date with respect to the input files.
4>CopyFilesToOutputDirectory:
4>  Engine.Game -> <solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\Engine.Game.exe
4>IncrementalClean:
4>  Deleting file "<solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\circle.xnb".
4>  Deleting file "<solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\giroux.xnb".
4>  Deleting file "<solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\Body_Neutral.xnb".
4>  Deleting file "<solution-dir>\src\Engine.Game\Engine.Game\bin\x86\Debug\font.xnb".
4>
4>Build succeeded.
4>
4>Time Elapsed 00:00:01.72
========== Build: 4 succeeded, 0 failed, 1 up-to-date, 0 skipped ==========


I can't think of how build settings could change between consecutive executions. Like I said, this only happens for half our group. One member is on a 32-bit Windows 7 Prof bootcamp partition on a Mac. Everyone else, including those who don't have the issue, are running straight 64-bit Windows 7 Prof. Both have tried using VS 2010 and VS 2012.

Any insight would be greatly appreciated. Also, I can post more details upon request if this isn't thorough enough.

EDIT 1: Upon further investigation, all the files are going to the right place (Content/Whatever/File), but what's odd is that upon finishing the build, the Content directory is just deleted from the Editor output directory, but not the Game output directory.

EDIT 2: I built the Editor project again, which rebuilt all the content to the proper spot in the Editor output directory, but removed it from the Game output directory for some reason.

• I believe, though I'm not sure, that the build instructions for files (The bottom right corner when clicking on a content object) are stored in the user file attached to a project. Depending on what you're storing and ignoring in git, it's possible that the version control is screwing things up. – Phil Nov 30 '12 at 1:51

I've had a similar problem recently. What worked for me was creating a separate build configuration for the editor. This config excludes building the main game project. The main game project excludes building the editor.

When I'm working on the editor I switch to that configuration in Visual Studio, and back to the main config when working on the game.

This is easy to do, and keeps the content from rebuilding every time.

Previously, with the editor and game both building, and both referencing the content project, the content would build every time, which was quite annoying.

I'm a relative beginner, but I read something about this recently. You mentioned consolidating content projects--the game and level editor developed over the course of the book XNA 4.0 Game Development by Example use two different (but identical) content projects; the author states that the reason for this is that XNA just won't let you have two projects reference the same content project unless they're targeting different platforms (PC and 360, etc). The author doesn't even attempt to explain why it doesn't work, unfortunately. This may be the source of your problems.

This is an ooooold question, but the problem can still occur with the current (3.6) version of MonoGame where the project content files are rebuilt every time you build the project. So changing a single line of code can result in a long delay when you test the project as all the content gets reimported...

The solution is to select the Content.mcgb file in the Visual Studio solution explorer pane to expose the properties for the pipeline tool. Change the "Build Action" to "None" - now the content will only be built when you manually start this in the pipeline tool.