[Mono-dev] Compiling a C# project with Xamarin Studio + MonoRuntime does not work.

Mackey Kinard Mackey at ehsiplus.com
Sun Apr 20 16:49:00 UTC 2014


Your cs1685 error is because your are duplicating the definition of the compiler services class.
This mainly happens when you are making extension to classes. If your are targeting .net
3.5 or higher the extension attribute is define in mono... In previous versions ... Like .net
2.0 you had to define the attribute yourself...

So probably when you made library of code that required you to define extension attribute that
Was .net 2.0... But you are using that library in a .net 3.5 or greater project which already has
Extention attribute defined...

I usually make a separate dll with the extension attribute as the only class... Then in my .net
2.0 projects (that I keep 2.0 to maintain compatible usage of my library for all versions) I reference this dll with the extension attribute... Otherwise, no need to define the extension attribute at all (for new .net projects)

Sent from my iPad

> On Apr 20, 2014, at 6:23 AM, Vardar Sahin <sakirsoft at gmail.com> wrote:
> 
> Hi Guys,
> 
> I have a C# project which compiles just fine with Visual Studio. It also compiles when I use Xamarin Studio and the .Net runtime. But when I choose to use the MonoRuntime it does not compile anymore. 
> 
> I am using the current version of Xamarin Studio ( 4.2.3 ). Interesting is that when I use an older Version of Xamarin Studio ( 4.1.9 ) + MonoRuntime it works.
> 
> I am on Windows and use the latest stable version of mono ( 3.2.3 ).
> 
> The compiler error I get is the following. 
> 
> Error CS0433: The imported type `System.Action<T1,T2>' is defined multiple times (CS0433) 
> 
> Also I have a Warning like this
> 
> Warning CS1685: The predefined type `System.Runtime.CompilerServices.ExtensionAttribute' is defined multiple times. Using definition from `mscorlib.dll' (CS1685) 
> 
> The signature of the function where the error occurs is this. 
> 
> private void ApplyCollision(ulong goId, CollisionData data, Action<ICollisionListener, Collision> func)
> 
> 
> Any ideas how to fix this?
> 
> Best
> Sahin
> 		
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140420/a48925f6/attachment.html>


More information about the Mono-devel-list mailing list