2014-05-15 75 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