2

Closed

"'System.Func' is defined in multiple assemblies" with Microsoft.Bcl.Async package

description

When using CM in a WP7.1 project and also using the new Microsoft.Bcl.Async package (https://nuget.org/packages/Microsoft.Bcl.Async) with the following compilation error results:

Error 1 The predefined type 'System.Func' is defined in multiple assemblies in the global alias; using definition from 'c:\dev\Gardiner.PublicToilets-hg\packages\Caliburn.Micro.1.0.0\lib\SL40-wp\Caliburn.Micro.dll' C:\dev\Gardiner.PublicToilets-hg\Gardiner.PublicToilets\error CS1685 Gardiner.PublicToilets

This seem to be due to the inclusion of the System.Func delegate in Caliburn Micro
Closed Dec 11, 2012 at 7:33 PM by EisenbergEffect
Fixed.

comments

jamie94bc wrote Nov 5, 2012 at 2:16 PM

Download the source code, remove System.Func, compile and use the newly compiled DLLs.

mvermef wrote Nov 5, 2012 at 3:39 PM

to maintain compatibility for those still using 7.1 new projects should be created with new project directives for WP8, followed by placing #if WP71 around the ActionDelegate extension to exclude it from the WP8 package.

Since 7.1 while still available the hardware requirements for WP8 SDK are out of reach for some developers at present.

mvermef wrote Nov 5, 2012 at 3:41 PM

just realized that they are using the newer async bcl. my last comment can probably disregarded

damirarh wrote Dec 3, 2012 at 8:07 PM

A similar warning comes up when using CM with WP8:

The predefined type 'System.Func' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.0\mscorlib.dll'
The predefined type 'System.Action' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhone\v8.0\mscorlib.dll'

I suppose this is what mvermef was refering to in his comment.

tibel wrote Dec 8, 2012 at 11:32 AM

I removed ActionDelegate.cs from WP8 build.

For WP7 the best fix would be to change the namespace in ActionDelgate.cs from 'System' to 'Caliburn.Micro'. But this will break binary compatibility. So I'm not sure if we can do this for a 1.4.1 release?