Reference of 2.0 DLL in 3.5 client Profile C# project
I have C# DLL created using frameowrk 2.0 this DLL I have added as a reference in another C# project created using #.5 client profile framework. AFter adding reference and build the code I got warning saying reference could not be reolved as the referenced DLL has reference to s开发者_开发问答ystem.web of versiob 2.0. If I add reference of system.web in 2.0 DLL and build and use this DLL as reference warning is removed.
So I would like is it not possible to reference 2.0 DLL in 3.5 client profile project? Adding system.web as a refernce increasing external DLL dependency so i am looking for solution which would remove this dependency.
Thanks
Of course you can reference a .NET 2.0 assembly in a .NET 3.5 client profile project. But that 2.0 assembly cannot reference System.Web as that assembly is not in the client profile. The .NET version has nothing to do with it. You can't have a reference*, for instance, from a .NET 4.0 project with client profile, to a .NET assembly which needs System.Web. Because that would mean you also need System.Web. Which is not on the client profile. Well, you get my drift.
*Actually, you can, but as you saw, you'll get warning. If the assembly you're referencing doesn't actually use any of the System.Web stuff, for example, you won't have any run-time errors (but why reference it in that case?)
精彩评论