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)
Compiling from services and downloading the development build still gives me this issue… Any other ideas?
Is there any solution or way around?
I’ve got the same problem while porting my app from xna to monogame.uwp
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=188.8.131.529, Culture=neutral, PublicKeyToken=null’ and ‘System.IO.FileSystem.Primitives, Version=184.108.40.206, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’
Anyone found a solution?
There are a few workarounds in .NEt to get past name collisions… You can use the full type name, System.IO.FileMode.Append
or you can use an alias at the top of the file
using catpants = System.IO.FileMode;
Hope this helps. Cheers!
Here’s my solution:
Create a new project and include it in the project that requires FileMode. Add the following class
public sealed class Helper
public enum FileModeType
public static FileMode FileMode(FileModeType type)
throw new Exception("No such FileMode");
Now to use for example IO.FileMode.Open you use EX.Helper.FileMode(EX.Helper.FileModeType.Open)
Some time ago I tried to use alias and found some dificulties and don’t remember now what is.
Using another project works!
But i’ve found a third way - using stream async methods directly cause my project is for UWP
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.