I’m working on moving my XNA game to MonoGame. I have finally reached an issue with System.IO.FileMode and System.IO.FileAccess. Both of these are in both mscorlib and monogame.framework. I have tried the following and none of them work. I’m using VS 2015 if that matters.
global::System.IO.FileMode.Open -> still gives the same error
using io = gloabal::System.IO; io.FileMode.Open -> still gives teh same error.
Any one know a work around for this issue with monogame?
if talking about UWP, this may be related to https://github.com/mono/MonoGame/pull/4039 and if so, it was fixed some days ago (using a development build or compile from source should fix the problem)
I also have the same problem. I need to use IsolatedStorageFile.OpenFile FileMode and get the error:
The type ‘FileMode’ exists in both ‘MonoGame.Framework, Version=3.4.0.459, Culture=neutral, PublicKeyToken=null’ and ‘System.IO.FileSystem.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’
Create a new project and include it in the project that requires FileMode. Add the following class
using System;
using System.IO;
namespace EX
{
public sealed class Helper
{
public enum FileModeType
{
CreateNew,
Create,
Open,
OpenOrCreate,
Truncate,
Append
}
public static FileMode FileMode(FileModeType type)
{
switch (type)
{
case FileModeType.CreateNew:
return System.IO.FileMode.CreateNew;
case FileModeType.Create:
return System.IO.FileMode.Create;
case FileModeType.Open:
return System.IO.FileMode.Open;
case FileModeType.OpenOrCreate:
return System.IO.FileMode.OpenOrCreate;
case FileModeType.Truncate:
return System.IO.FileMode.Truncate;
case FileModeType.Append:
return System.IO.FileMode.Append;
}
throw new Exception("No such FileMode");
}
}
}
Now to use for example IO.FileMode.Open you use EX.Helper.FileMode(EX.Helper.FileModeType.Open)
I was having the same issue and it was because I was referencing the MonoGame in the ‘Windows8’ folder. I had to manually browse and select the one in the ‘Windows’ folder. This fixed the issue for me.