May 25, 2010

Nasty problem with Blend 4

So the last two work days my boss and I where looking for a rather nasty little problem in our internal controls library for SL4. For some reasons Blend 4 (RC) told us on some simple properties of out controls (in global.xaml) that they didn't exist. So designing with blend didn't work anymore in all our project using our lib. This only applied to simple properties, more complex ones worked just fine. In our case this are mostly Boolean and Double propeties.

The error we get in Blend is: The member 'XXX' is not recognized or is not accessible.

We tried a lot of different things to get some more detailed information to the problem Blend has with our lib. No chance. So I started to create a new project and copy one control after the other to the new one. In the end all controls worked fine in the new project. So where was the problem you ask? Well, it turns out that we had one missing reference which doesn't raise any problem in VS or the final application. Just Blend can't find it and with that doesn't know about these basic properties.

The problem is a reference added by default if you create a new project. For some reason it was missing in ours (don't ask me why). Its the 'mscorlib.dll' located within 'Program Files\Reference Asssemblies\Microsoft\Framework\Silverlight\v4.0'. After adding that one everything was fine with Blend again. Btw. if it should be missing in your project you need to add it by editing the project file. For some reason you can't add it in VS's project properties.

Hope this saves some hours of time for somebody :)