views:

27

answers:

1

I have some c# source that I want to compile using CodeDom within my application (for a plugin)

Everything works fine, except if I use a Linq extension function on some of my collections

var dict = new Dictionary<KeyType, ValueType>();
....
dict.Any(KV=>KV.Key == "Some Key");

When I try to compile source that has this code, it CodeDom complains that I am missing a reference to DependencyObject in WindowsBase.

I do not understand why this is happening. Neither the Dictionary class, or the Any extension method reference that class, which apparently is part of Windows.Forms

I would normally just ignore the quirk, make the CodeDom add a reference and move on, but Apparently WindowsBase is special and is not always distributed and I don't want to cause issues for users that may not have it installed correctly.

+1  A: 

I solved the immediate problem by adding a reference to WindowsBase in my application, and setting it to always copy. Then I was able to add the reference in codeDom correctly.

Im still confused as to why the DLL is needed, but I have worked around it.

Jason Coyne