You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
5.[Creating Your ContentCollection](#creating-your-contentcollection)
29
+
6.[Including and Excluding Content](#including-and-excluding-content)
30
+
7.[Working with Importers and Processors](#working-with-importers-and-processors)
31
+
8.[Advanced Scenarios](#advanced-scenarios)
31
32
32
33
---
33
34
@@ -122,6 +123,61 @@ This is the default (recommended) layout for a Content Builder project, but you
122
123
> [!TIP]
123
124
> While it is possible to include the builder as part of your game code, rather than a separate project, at this time we do not recommend this. Based on experience, it is always better to build your content separate from your runtime game to avoid collisions or issues arising in game production/deployment.
124
125
126
+
## Adding the Content Builder Project to your Game
127
+
128
+
Once you have created your `Builder` project, you have two options:
129
+
130
+
1. After building your game, you need to copy the build output from the Builder to the output of the Game, so the `exe` and the `content` folder are in the same output folder.
131
+
2. Add a `Target` definition to your `csproj` to automatically copy the Builder output to the game output when the project is built (like how the current MGCB solution works)
132
+
133
+
This section will focus on Option 2 to replicate what happens in `3.8.4` projects.
134
+
135
+
### 1. Clean up redundant files
136
+
137
+
As the Content Builder project is **NOT** a DotNet tool, you no longer need the `dotnet-tools.json` configuration.
138
+
139
+
1. Remove any `.config` folders from your solution that contain `dotnet-tools.json` files.
140
+
141
+
### 2. Remove legacy MGCB references from your `csproj`
142
+
143
+
As you would expect, we no longer need any old `Content` references or tools for building that content, aka, the `MonoGame.Content.Builder.Task` reference.
144
+
145
+
Per platform/game project:
146
+
147
+
1. Remove any `MonoGameContentReference` elements from your game's `csproj`.
148
+
2. Remove references to `MonoGame.Content.Builder.Task`.
149
+
3. Update the MonoGame version to match the Builder (not essential, but recommended)
150
+
151
+
### 3. Add the Builder task
152
+
153
+
To complete the process, add the following `Target` section to your `csproj` (before the final ```</Project>``` entry):
Of note, you should take care with the following elements:
169
+
170
+
-`-s Assets` - this assumes you are using the default "Assets" source folder in the builder project. If your source content is elsewhere you will need to provide the path to it.
171
+
-`-i $(ContentTemp)` - this uses the default `obj` folder for building the content, if you are short on space, you can provide an alternate path for temp storage.
172
+
-`Projects="..\Content\Content.csproj"` - This should **MATCH** the folder and project name of your Builder. If you called your Builder something else or renamed the folder/csproj, make sure it matches.
173
+
174
+
You should not need to touch anything else.
175
+
176
+
> [!NOTE]
177
+
> Additionally, if you want to control HOW and WHEN your content is built/rebuilt, then you can change the `Targets="Build;Run"` options to only execute the last on Build OR Run, or a different action.
178
+
>
179
+
> See the [MS Documentation on Built targets](https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-targets) for reference.
180
+
125
181
## Basic Builder Project Structure
126
182
127
183
The default `Builder.cs` file looks like this, which contains everything needed to build all content in the designated Assets/Content folder using the default [Importers and Processors](/articles/getting_to_know/whatis/content_pipeline/CP_StdImpsProcs) (how MonoGame compiles content) into processed `.XNB` files for consumption by your runtime project:
0 commit comments