Zuhaib

A very lazy but meticulous blogger

ASP.NET WebApplication Fails To Load In Visual Studio 2008 After Upgrading In Visual Studio 2010

with 4 comments

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.

Possible Related Posts:

  1. Visual Studio 2010 Dark Expression Blend Color Theme
  2. Windows 2008 & Visual Studio Web Setup: The installer was interrupted before ApplicationName could be installed
  3. Visual Studio 2010: Installing MSDN Documentation
  4. Visual Studio 2010 Beta 2 Now Out For Public
  5. Clearing AnkhSVN Saved UserName/Password/Authentication Data

Written by Zuhaib

May 18th, 2010 at 11:30 am

4 Responses to 'ASP.NET WebApplication Fails To Load In Visual Studio 2008 After Upgrading In Visual Studio 2010'

Subscribe to comments with RSS or TrackBack to 'ASP.NET WebApplication Fails To Load In Visual Studio 2008 After Upgrading In Visual Studio 2010'.

  1. It seems to allow the project to build fine, but when trying to “publish”, I get an error “The target “PipelinePreDeployCopyAllFilesToOneFolder” does not exist in the project.”

    Otherwise, I believe your solution is fine. Thank you.

    [ Reply ]

    Zuhaib Reply:

    @Carl,
    VS 2008 does not have any such targets. VS2010 contains the target PipelinePreDeployCopyAllFilesToOneFolderin v1.0\Web\Microsoft.Web.Publishing.targets.

    Which means your Web Application v10.0 target is being used. Are you using VS2010 to publish?

    [ Reply ]

    Carl

    24 May 10 at 1:54 pm

  2. Correct, I’m trying to publish with VS2010. A colleague hasn’t had a chance to upgrade to VS2010 yet, so he uses VS2008. So that is why I tried this solution, so I could stick with VS2010, and he could still get the project to work with VS2008.

    [ Reply ]

    Zuhaib Reply:

    @Carl, If you are using VS2010 then you should be able to publish. Just make sure the targets file is present in the web folder. If its not present then, you should probably reinstall Visual Studio.

    [ Reply ]

    Carl

    25 May 10 at 8:37 am

Leave a Reply