I have a web server control library (the real stuff, not user controls) that I often include in web sites. While building a 4.0 site, I encountered:
The type name 'MembershipUser' could not be found. This type has been forwarded to assembly 'System.Web.ApplicationServices, Version=188.8.131.52, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. Consider adding a reference to that assembly.
So all that needs to be done is add a reference to this DLL.
I am not happy with how they did it --- it breaks normative conventions…. The DLL. “System.Web.ApplicationServices” does not contain a class called: System.Web.ApplicationServices.
Second, the two classes in it would be flagged as a misplacement in any respectable code review!
In terms of maintaining one code base that will support .Net2 thru .Net4, it may be done by using two projects:
with the .cs files being shared. In this case the members of the classes appear unchanged, but if they were changed then I would need to add a C# directive “NET4” and conditionally code – still allows me to maintain a single .cs file for each of the control.