VS2005建立的Web Application项目,升级到VS2008后,就无法再用VS2005打开了。
要使WebApplication项目文件兼容VS2005和VS2008,需在.csproj文件中找到如下一行:
<ImportProject="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets"/>
升级之前是:<ImportProject="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets"/>
如果要同时兼容VS2005和VS2008,必须改为:
<ImportProject="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets"Condition="'$(Solutions.VSVersion)' == '9.0'" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets"Condition="'$(Solutions.VSVersion)' == '8.0'" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v8.0\WebApplications\Microsoft.WebApplication.targets"Condition="'$(Solutions.VSVersion)' == '8.0'" />