Some .NET libraries or components may use the same type / enum name which can make the Visual Studio compiler generate an error with the message:
“the type exists in both versions”
Visual Studio compiler error
In order to fix that issue, you can do as follow:
- Goto References and select one of the libraries that generated this error.
- In the Properties change the Alias property to ‘MyAlias’.
- Add to the top of the class that used the library:
//Declear the alias name of the library
extern alias MyAlias;
//------------------------------
//The rest of your code...
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
That’s it 🙂
From now on you can create a reference to the library like:
MyAlias.TheLibrary.ClassName xyz;