Architect's Log

I'm a Cloud Architect. I'm highly motivated to reduce toils with driving DevOps.

【ASP.NET】compilation要素とhttpRuntime要素のtargetFrameworkプロパティの使い分け

.NET3.5のASP.NETアプリを.NET4.6にアップグレードした。

<system.web> 
    <compilation debug="true" targetFramework="4.6" /> 
    <httpRuntime targetFramework="4.6" /> 
</system.web> 

compilation要素とhttpRuntime要素のtargetFrameworkプロパティの使い分け。

  • compilation要素のtargetFrameworkプロパティは、ビルド時に参照される.NETFrameworkのバージョン。
  • httpRuntime要素のtargetFrameworkプロパティは、実行時に参照される.NETFrameworkのバージョン。
    • exeの場合は、app.configのsupportedRuntime要素で指定できるが、ASP.NETはapp.configが使えないので、httpRuntime要素を使用する。

参考

stackoverrun.com

devblogs.microsoft.com

codeday.me

docs.microsoft.com

opentouryo.osscons.jp