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?
Using XNA Content Pipeline in a C# Form
1.3k Views Asked by Jamie At
2
There are 2 best solutions below
2

Take a look at the Winforms Series 2: Content Loading AppHub sample.
Basically you load and call appropriate microsoft.xna.framework.content
classes to read your compiled xnb files.
You'd use classes in the namespaces within microsoft.xna.framework.content.pipeline
to create the xnb files (which is what the content project would do for you).
See here for an overview of the content pipeline: What is the Content Pipeline?
Is there another way to load and deserialize my XML content?
Yes, use any .net method of serialising you want, maybe XDocument
.
Manually edit the .csproj file and add the following in the first
PropertyGroup
section which contains the assembly name, project guid etc.You'll probably need to also add
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.