views:

40

answers:

2

I get the following as a warning during build of my asp.net application:

The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll'

How do i resolve this warning?

A: 

from MSDN

Visual C# Reference: Errors and Warnings Compiler Warning (level 1) CS1685

Error Message The predefined type 'System.type name' is defined in multiple assemblies in the global alias; using definition from 'File Name'

This error occurs when a predefined system type such as System.int32 is found in two assemblies. One way this can happen is if you are referencing mscorlib from two different places, such as trying to run the.Net Framework versions 1.0 and 1.1 side-by-side.

Based on this, we probably need to see the list of assemblies and their references to help you much.

BioBuckyBall
A: 

From this blog:

So the final solution was to use the InternalVisibleTo attribute in one of the assemblies. This means ExtensionAttribute only needs to be defined in one assembly. There's more info here on how to do that with strongly named assemblies since it's not completely straight forward.

Related question: http://stackoverflow.com/questions/602927/c-compiler-warning-1685

Dave Swersky