Glimpse/Glimpse — Issue #159: Glimpse & Castle.DynamicProxy incompatible
Author: mattscully
Created: 2012-02-10 20:00:31+00:00
State: open

The problem I'm seeing is that if an application needs to use any Castle.DynamicProxy type that Glimpse embeds (through ILMerge) in the Glimpse.Mvc3 DLL *and* it is listed in the ILMergeInternalize.txt file, the application code will get an ambiguous reference compile error:

```
Error	1	The type 'Castle.DynamicProxy.IProxyGenerationHook' exists in both
'\GlimpseCastleBug\packages\Glimpse.Mvc3.0.87\lib\net40\Glimpse.Mvc3.dll' and
'\GlimpseCastleBug\packages\Castle.Core.2.5.2\lib\NET35\Castle.Core.dll'
\GlimpseCastleBug\GlimpseCastleBug\Class1.cs
```

I am unfamiliar with ILMerge, but the problem I'm seeing is that when Glimpse performs the ILMerge as part of its packaging, it embeds Castle.Core and Castle.DynamicProxy with the /internalize option. This option will change the accessibility of types to internal except for those listed in the ILMergeInternalize.txt file. If my application needs to use both types that are public in the Glimpse.Mvc3 DLL and other public types in Castle.Core/Castle.DynamicProxy, then I encounter this ambiguous reference error. Please see the attached solution as an example.

I'm not sure what the solution is for this, but I see that the [Microsoft actually suggests](http://research.microsoft.com/en-us/people/mbarnett/ilmerge.aspx) an [alternative to ILMerge](http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx). But I'm not sure if this would solve the problem or not.

Thanks!