Search code examples
c#xnadeserializationcontent-pipeline

Using XNA Content Pipeline in a C# Form


I'm trying to create a game editor using a C# form, and I've run into a problem when it comes to deserializing; I can't use the content pipeline in a forms application as I don't even have the option to add any content reference to the project. How can I use the content pipeline with my form app? Is there another way to load and deserialize my XML content?


Solution

  • Manually edit the .csproj file and add the following in the first PropertyGroup section which contains the assembly name, project guid etc.

    <ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
    

    You'll probably need to also add

    <XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
    <XnaPlatform>Windows</XnaPlatform>
    

    Reload the project in VS, and you should be able to add content references to it.

    The two GUIDs specified there are for Windows and XNA (Windows). Here is a list of some common project type guids (although slightly dated) if you need to retarget the project at all.