Weird errors with .NET Framework Client Profile referencing Full Profile Assemblies
Tigraine
Daniel Hoelbling talks about programming and technology

Weird errors with .NET Framework Client Profile referencing Full Profile Assemblies

September 05, 2010 by Daniel Hoelbling

I am currently working on a little demo project with NServiceBus and ran into this so I thought I’d share it:

If you create a new WPF project in VS2010 it will target by default the .NET FX Client Profile. That’s nice for a  number of reasons, but you will see very weird behavior once you reference an assembly that requires the full .NET profile.

In my case it was NServiceBus that I was referencing. Although the using directives where there, and I got full IntelliSense (and the reference showed up in VS) I got this compile error:

image

The code in question looks innocent:

image

Well: The reason for this weirdness is the .NET Client Profile. NSB requires stuff that’s not in the Client Profile thus the compiler will not resolve the reference. Visual Studio has no clue about that and isn’t displaying meaningful errors.

The solution is obviously simple: Go to the project preferences and select the appropriate Target framework:

image

Hope this helps!