@alt wrote:
I've been trying to recreate the RolePlayingGame sample found here as a UWP project. It is giving me trouble building the xml content.
To isolate the problem, I have created a new
MonoGame Windows 10 Universal (Core Application)
solution in Visual Studio. This solution contains two projects:RPG
andRPGData
.The
RPG
project is the main executable project. The only changes I have made to this project are adding,MainGameDescription.xml
to theContent
folder, and including the xml file inContent.mgcb
.MainGameDescription.xml:
<?xml version="1.0" encoding="utf-8"?> <XnaContent xmlns:ns="Microsoft.Xna.Framework"> <Asset Type="RPGData.GameStartDescription"> <MapContentName>Map001</MapContentName> <PlayerContentNames> <Item>Kolatt</Item> </PlayerContentNames> <QuestLineContentName>MainQuestLine</QuestLineContentName> </Asset> </XnaContent>
Content.mgcb:
#----------------------------- Global Properties ----------------------------# /outputDir:bin/$(Platform) /intermediateDir:obj/$(Platform) /platform:WindowsStoreApp /config: /profile:Reach /compress:False #-------------------------------- References --------------------------------# #---------------------------------- Content ---------------------------------# #begin MainGameDescription.xml /importer:XmlImporter /processor:PassThroughProcessor /build:MainGameDescription.xml
The
RPGData
project is aClass Library (Universal Windows)
project. I have given it a reference to the sameMonoGame.Framework
as theRPG
project. It contains theGameStartDescription
class.GameStartDescription.cs:
using Microsoft.Xna.Framework.Content; using System.Collections.Generic; namespace RPGData { /// <summary> /// The data needed to start a new game. /// </summary> public class GameStartDescription { #region Map /// <summary> /// The content name of the map for a new game. /// </summary> private string mapContentName; /// <summary> /// The content name of the map for a new game. /// </summary> public string MapContentName { get { return mapContentName; } set { mapContentName = value; } } #endregion #region Party /// <summary> /// The content names of the players in the party from the beginning. /// </summary> private List<string> playerContentNames = new List<string>(); /// <summary> /// The content names of the players in the party from the beginning. /// </summary> public List<string> PlayerContentNames { get { return playerContentNames; } set { playerContentNames = value; } } #endregion #region Quest Line /// <summary> /// The quest line in action when the game starts. /// </summary> /// <remarks>The first quest will be started before the world is shown.</remarks> private string questLineContentName; /// <summary> /// The quest line in action when the game starts. /// </summary> /// <remarks>The first quest will be started before the world is shown.</remarks> [ContentSerializer(Optional = true)] public string QuestLineContentName { get { return questLineContentName; } set { questLineContentName = value; } } #endregion #region Content Type Reader /// <summary> /// Read a GameStartDescription object from the content pipeline. /// </summary> public class GameStartDescriptionReader : ContentTypeReader<GameStartDescription> { protected override GameStartDescription Read(ContentReader input, GameStartDescription existingInstance) { GameStartDescription desc = existingInstance; if (desc == null) { desc = new GameStartDescription(); } desc.MapContentName = input.ReadString(); desc.PlayerContentNames.AddRange(input.ReadObject<List<string>>()); desc.QuestLineContentName = input.ReadString(); return desc; } } #endregion } }
Lastly, I have referenced the
RPGData
project inRPG
.Building the solution gives two errors:
The command ""C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe" /@:"c:\users\user\documents\visual studio 2017\Projects\RPG\RPG\Content\Content.mgcb" /platform:WindowsStoreApp /quiet /outputDir:"bin\WindowsStoreApp\Content" /intermediateDir:"obj\WindowsStoreApp\Content"" exited with code 1.
Importer 'XmlImporter' had unexpected failure!
I am new to MonoGame so this is a bit of trial and error for me. I tried adding a reference to the RPGData library in
Content.mgcb
, but it gave me some kind of "Library corrupt" error. Should I be placing a reference to the library here?Upon using
fuslogvw
(Assembly Binding Log Viewer), I am greeted with two errors. One forMGCB.XmlSerializers
and one forSharpDX.Mathematics
. Ignoring the SharpDX error for now, here is theMGCB.XmlSerializers
log:*** Assembly Binder Log Entry (2/24/2018 @ 8:27:48 PM) *** The operation failed. Bind result: hr = 0x80070002. The system cannot find the file specified. Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll Running under executable C:\Program Files (x86)\MSBuild\MonoGame\v3.0\Tools\MGCB.exe --- A detailed error log follows. === Pre-bind state information === LOG: DisplayName = MGCB.XmlSerializers, Version=3.7.0.1279, Culture=neutral, PublicKeyToken=null, processorArchitecture=MSIL (Fully-specified) LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/ LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = MGCB.exe Calling assembly : System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. === LOG: This bind starts in default load context. LOG: No application configuration file found. LOG: Using host configuration file: LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config. LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind). LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/MGCB.XmlSerializers.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/MGCB.XmlSerializers/MGCB.XmlSerializers.DLL. LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/MGCB.XmlSerializers.EXE. LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/MonoGame/v3.0/Tools/MGCB.XmlSerializers/MGCB.XmlSerializers.EXE. LOG: All probing URLs attempted and failed.
At this point, I don't know enough about how the
MonoGame Content Pipeline
to understand exactly what is going on here.My understanding is that
Content.mgcb
contains a list of content as well as what to do with it at build time. In this instance, my Xml file is being imported withXmlImporter
.XmlImporter
I assume, is a part of the MonoGame Framework. While being imported, the importer looks at the XmlAsset Type
tag and serializes to that.Is this correct? What could I be missing that would cause the build to fail?
Any input is appreciated!
Posts: 1
Participants: 1