1
votes

I had a Class Project in .Net This Project is Generic .This Project get treeNode Control (Web and windows(generic))and Return (Web Or Windows )TreeNode. In Windows Project I Reference this generic project and have an error

Warning 1 The referenced assembly ".......dll" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.

how to solve this problem and use this generic class project in windows and web projects

2

2 Answers

0
votes

Add a reference to System.Web.dll to your project. If your project will be running on computers with the ".NET Client Profile" then you just need to ensure a copy of System.Web.dll is bundled with your application.

0
votes

".NETFramework,Version=v4.0,Profile=Client" means "Client profile", which means that only a subset of the .net will available to your app. System.Web.* assemblies are not part of that subset. The compiler is complaining because you have a reference to an assembly that is not part of the Client Profile and is not referenced by your project, so it cannot resolve the assembly location. You must include a reference to the referred assembly and change the property "Copy local" to "true" (Click on assembly reference then F4). This will cause the assembly to be copied into the "/bin" folder of the current project. You must also deploy this assembly with your project because it will not be available on the client machine.