2014-05-15 162 views
5

建设部署包时,遇到了从aspnet_compiler.exe以下警告时:WebGrease警告构建部署包

ASPNETCOMPILER(0,0): Warning : The following assembly has dependencies on a version of the .NET Framework that is higher than the target and might not load correctly during runtime causing a failure: WebGrease, Version=1.6.5135.21930, Culture=neutral, PublicKeyToken=31bf3856ad364e35. The dependencies are: System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. You should either ensure that the dependent assembly is correct for the target framework, or ensure that the target framework you are addressing is that of the dependent assembly. 

同样的事情发生,我从1.3.0.0版本更新之前WebGrease 尝试以下两个组件绑定没有成功:

<dependentAssembly> 
    <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" /> 
    <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" /> 
    </dependentAssembly> 

<dependentAssembly> 
    <assemblyIdentity name="System.Windows.Forms" publicKeyToken="b77a5c561934e089" /> 
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" /> 
</dependentAssembly> 

我花在这个已经煎炸不同配置的2天,将不胜感激任何提示或帮助。

回答

6

从错误消息中,问题出现在您定位的.Net框架中。右键单击该项目,选择属性,然后将.Net目标框架更改为4.5.1。从Visual Studio 2012移至2013年后,我遇到了同样的问题,并为我解决了这个问题。希望这有助于

3

web.config解决了这个问题,通过增加对System.Windows.Forms的具有以下配置的参考:

<system.web> 
    <compilation debug="true" targetFramework="4.5.2"> 
    <assemblies> 
     <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> 
    </assemblies> 
    </compilation> 
</system.web> 

灵感来自answer