How to: Add a Resource to the Content Pipeline
This example demonstrates how to load a texture using the XNA Framework Content Pipeline. The same procedure can be applied to models and sounds. It is assumed that an existing Windows game project is loaded in XNA Game Studio Express. In this example, the project is called CPTexture.
To add the texture to the game project
From the Solution Explorer window, right-click the CPTexture project item, click Add, and then click Existing Item.
From the Files of type: drop-down list, select the XNA Content Files entry.
Navigate to the location of the texture and select it. For this example, the asset is called B1_nebula01.tga.
Click the small arrow to the right of the Add button, and then click Add as Link. This creates a reference to the selected asset (and not a copy) in your project.
Tip
Making a reference to an existing file in your project is quite different than adding an existing item to your project. A file reference stores only the path to the file in question, not a copy of the contents. This is useful if the referenced file is dependent on additional external files and ensures that the latest version is always used by the solution. This differs from adding a copy of the file to the project. In this case, it is possible to break external file dependencies and create extra work if the original content changes but the copy is not updated.
For these reasons, it is recommended that any media used by the solution be in a subfolder of the solution and that a reference to the media is added and not a copy.
After adding the asset to the solution, open the Properties window to verify that the proper importer and processor are specified (right-click on the file in Solution Explorer and choose Properties from the context menu). For this example, the Content Importer is Texture and the Content Processor is Texture (Sprite, 32bpp). For ease of reference, the asset name value was manually changed to "nebula", using the Properties window.
For more information on the Properties window of a game asset, see Game Asset Properties.
Save the solution.