Archive for the ‘vs2008’ tag
ASP.NET WebApplication Fails To Load In Visual Studio 2008 After Upgrading In Visual Studio 2010
Today after upgrading a ASP.NET Web Application project in Visual Studio 2010 the project failed to load in Visual Studio 2008. If the machine has both VS2008 and VS2010 installed then the project loaded just fine. But, if a machine does not has VS2010 installed the Web Application failed to load.
After the upgrade Visual Studio 2010 modified the following:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" /> TO <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
Because the v10.0 (second) path is not present in machines that do not have V2010 installed, VS2008 was unable to load the project.
After googling I came across this post which tells to use MSBuild’s condition statements to specify the correct path based on the the Visual Studio version. His solution worked fine, the only problem that I faced was when I open the solution in VS2010, it again asked to upgrade the project file, doing which changed the v9.0 path to v10.0 path.
I had to make few minor changes to solve this problem:
Step1:
Add the V10.0 path before the V9.0 MSBuild extension path with a Condition property to check for the file based on the Solution Version.
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="'$(Solutions.VSVersion)' == '10.0'" /> <Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" Condition="'$(Solutions.VSVersion)' == '9.0'" />
Here is we do not specify the Visual Studio 2010 MSBuild extension path first the Visual Studio will try to upgrade the project.
Step2:
After the project file upgrade VS2010 would have changed the FileUpgradeFlags tags value to 0, which would again trigger an upgrade. Remove the Zero from the tag.
<FileUpgradeFlags></FileUpgradeFlags>
Save the project file and reload. Now you will be able to load the project in VS2010 & VS2008 (Even if VS2010 is not installed) without any problem.
Hope it helps.