关于错误could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, Public。。。。
今天搭建一个WinForm的框架,生成Form层的总是报这个错误:
The referenced assembly "d:\my documents\visual studio 2010\Projects\SLXJHosEme\SLXJHosEme.BLL\bin\Debug\SLXJHosEme.BLL.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. SLXJHosEme.Forms
最终找到了问题的原因,解释下:
Form层引用了BLL层,生成BLL层时没有报错,可生成Form层的时候却报BLL层有错,原因在于BLL层和Form层应用的.NETFramework版本不用。
奇怪吧,应用哪个版本的.NETFramework我没有主动的改过,但就是不同。
经检查发现,BLL层默认应用的是.NETFramework 4,而Form层默认应用的是 .NETFramework 4 Client Profile。
解决办法,在Form层的属性里,把 .NETFramework 4 Client Profile改为.NETFramework 4错误就没有了。

浙公网安备 33010602011771号