Hey everyone! I’ve finally decided to take the leap and port my current project from XNA 4.0 to Monogame. I tested the waters with an older, smaller project and all went well so I went ahead with transitioning my current larger project over and I’ve run into a strange error.
Here is the section of code in which the error pops up.
if (!SaveLoad.SaveFile.isStorageDeviceLoaded)
{
EasyStorageSettings.SetSupportedLanguages(Language.English);
//create and add SaveDevice
SharedSaveDevice sharedSaveDevice = new SharedSaveDevice();
RogueLike.Systems.Engine.Instance.Components.Add(sharedSaveDevice);
//make sure we hold onto the device
saveDevice = sharedSaveDevice;
sharedSaveDevice.DeviceSelectorCanceled +=
(s, e) => e.Response = SaveDeviceEventResponse.Force;
sharedSaveDevice.DeviceDisconnected +=
(s, e) => e.Response = SaveDeviceEventResponse.Force;
//prompt for a device on the first update we can
sharedSaveDevice.PromptForDevice();
sharedSaveDevice.DeviceSelected += (s, e) =>
{
SaveLoad.SaveFile.SaveDevice = (SaveDevice)s;
};
SaveLoad.SaveFile.isStorageDeviceLoaded = true;
}
So the error itself takes place in the section where I am attempting to create a SharedSaveDevice and add it to Components. The error message I receive are as follows.
Error 1 The type ‘Microsoft.Xna.Framework.IUpdateable’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553’.
Error 2 The type ‘Microsoft.Xna.Framework.IGameComponent’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553’.
Error 3 The best overloaded method match for ‘System.Collections.ObjectModel.Collection<Microsoft.Xna.Framework.IGameComponent>.Add(Microsoft.Xna.Framework.IGameComponent)’ has some invalid arguments
Error 4 Argument 1: cannot convert from ‘EasyStorage.SharedSaveDevice’ to ‘Microsoft.Xna.Framework.IGameComponent’
I tried looking online and the closest thing to an answer I’ve found is that I may need to recomplie my DLL game library after changing all the XNA references to MonoGame references.
I’m not sure what that means as I thought that MonoGame still uses all the same namespaces. Any help on this would be greatly appreciated!