everyone.
I am using Visual Studio
to develop uwp
application. The compiler says that type FileMode
exists in both MySql.Data.RT
and System.IO.FileSystem.Primitives
. The error message is below.
Error CS0433 Type 'FileMode' exists in both 'MySql.Data.RT, Version=6.7.8.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d' and 'System.IO.FileSystem.Primitives, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
However, I have used the complete name of the type as following.
FileStream fileStream = new FileStream(fileName, System.IO.FileMode.Open);
I don't know why there is still an error, any advice is welcome.
EDIT:
I don't think this question is duplicate because I could not find any way to modify the answer to the provided candidate duplicate question to solve the issue I encountered.
EDIT:
I eventually solved this issue myself. I found out that the namespace System.IO
exists in two dll
files, MySql.Data.RT
and System.IO.FileStream.Primitives
. That's why even I specified the full name of the object (System.IO.FileMode
), the compiler still doesn't know which dll file it should references the object to.
My solution is to add an alias to MySql.Data.RT
as MySQL
, and modify the code as following.
using MySql.Data.MySqlClient;
=>
extern alias MySQL;
using MySQL::MySql.Data.MySqlClient;
Note:
One can add an alias to a reference via right click on it in the solution explorer and then click the property
option, then the UI will appear.