Could not determine which version of ASP.NET Web Pages to use

10,212

My guess is that you now have alot of .net v2.0 projects and one .net v4.5.1 project in the same solution. Either your IIS express config or IIS configuration is now using an app pool v4.5.1

Share:
10,212
oscilatingcretin
Author by

oscilatingcretin

pronouns: you/your

Updated on June 06, 2022

Comments

  • oscilatingcretin
    oscilatingcretin almost 2 years

    Weird goings on with my VS2013 projects. I recently upgraded one of my project branches from .NET 4.0 to 4.5.1 and used NuGet package manager to install MVC 5 with Razor so that I could have a WebForms/MVC hybrid. So far, it's working fine and I am able to use both WebForms and MVC.

    However, all of my other branches of the same project (the production branch for example) appear to be broken when they have not changed. When I run one of the other projects, I get:

    Could not determine which version of ASP.NET Web Pages to use.

    After some looking around, I saw someone recommend putting this in the web.config appSettings:

    <add key="webpages:Version" value="2.0.0.0"/>

    Now when I run the project, I get this:

    HTTP Error 404.0 - Not Found

    What else is odd is that the URL is pointing to this:

    http://localhost:53305/Account/Login?ReturnUrl=%2findex.aspx

    I have no idea how making the change to MVC 5 in a different code branch could impact my other projects which are still straight WebForms using the 4.0 framework.

    Edit: It's probably worth noting that my other completely separate WebForms projects still work. It's only the other branches of this particular project that appear to be broken. It's almost as if there's some common configuration file shared between all of these branches that has been modified which ends up accommodating only the branch that was upgraded to MVC 5.

    Edit: In case how I installed the NuGet package is in question, here's what I did:

    • Right-clicked my project and selected Manage NuGet Packages
    • Clicked Online in the left pane and selected Microsoft ASP.NET MVC and clicked Install
    • It did whatever it did and installed it for that project.

    I do not have this package installed in my other branches. It's only a single branch. Somehow, it affected all branches and I do not know why.