Conflicting versions of ASP.NET Web Pages detected: specified version is "1.0.0.0", but the version in bin is "2.0.0.0" in ASP.MET MVC 3
Asked Answered
I

3

33

I am getting the following error after installing microsoft web helper:

Conflicting versions of ASP.NET Web Pages detected: specified version is "1.0.0.0", but the version in bin is "2.0.0.0". To continue, remove files from the application's bin directory or remove the version specification in web.config.

From what I read, I might have tried instaling the wrong version. But how do i orrect this? So far, I have

  • uninstall the microsoft web helper
  • Deleted and content of the bin folder and rebuild the project
  • Replace my web.config file with a new file with all defaults (given i did not change much here or my project.

But none of these (as suggested online) worked. Any hint on how to solve this please. Ihave been at this for hours now

Igorot answered 15/12, 2012 at 14:2 Comment(1)
R
67

I had this issue after upgrading to VS 2013 Express Preview.

Then I noticed there was a line in web.config that was:

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

Changed it to the version of system.web.webpages.dll in my bin folder:

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

...and the problem went away. (in your case I guess it's 2.0.0.0.)

Repine answered 9/7, 2013 at 12:43 Comment(2)
Do you know what dll this refers to?Deen
It refers to the System.Web.WebPages dll I believe.Tillis
M
5

This is just an addendum to Dave's answer but don't forget to change this in all the Views folders also, if you haven't. The best thing probably is to use the "Replace in Files" feature from VS (Ctrl+Shift+H) to ensure you didn't miss any occurrence.

Murdocca answered 16/1, 2014 at 13:53 Comment(0)
S
0

I'd like to add the following:

In my case, I was able to fix it the following way. First (important!), I changed the target framework to 4.6.1, reloaded the solution, then upgraded the binary packages by using NUGET.

Then, after fixing the issue as described by the solution above, I got additionally the errors:

Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: An error occurred creating the configuration section handler for system.web.webPages.razor/host: Could not load file or assembly 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' could not be loaded.

The relevant part of the root Web.config was looking like this:

<configSections>
    <sectionGroup name="system.web.webPages.razor" 
            type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, 
            System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, 
            PublicKeyToken=31BF3856AD364E35">
    <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, 
            System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, 
            PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, 
            System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, 
            PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
  </sectionGroup>

After changing that to:

  <configSections>
    <sectionGroup name="system.web.webPages.razor"  
        type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, 
            System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, 
            PublicKeyToken=31BF3856AD364E35"  >
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, 
            System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, 
            PublicKeyToken=31BF3856AD364E35"  />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, 
            System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, 
            PublicKeyToken=31BF3856AD364E35"  />
    </sectionGroup>
  </configSections>

it was instantly working.

Note that:

  • I also changed the property copy local to true for each System.Web.* assemblies.

  • In some projects, the section group sectionGroup name="system.web.webPages.razor" might as well be missing - you need to add it in that case.

  • If you plan to upgrade to MVC 4, first upgrade to MVC 3 before you do the final step, because there are some breaking changes in MVC 4 (see details here).

Siward answered 28/6, 2016 at 12:23 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.