-2

I am trying to compile this old project(link to old project) But I am getting a lot of missing namespaces which cannot be resolved. Usually, when I open older projects I can resolve these by clicking the lightbulb and import correct namespace but there are none suggested.

Dev
  • 1,780
  • 3
  • 18
  • 46
  • What kind of errors are you getting? – Hemi81 Feb 09 '17 at 13:09
  • Can you give an example of a missing namespace? Is this namespace related to your solution or part of .net? – elirandav Feb 09 '17 at 13:09
  • The type or namespace name 'SelectListItem' could not be found (are you missing a using directive or an assembly reference?) Then Remove Unnecessary Using – Dev Feb 09 '17 at 13:12
  • So, did you google that specific error? Gives you a number of hints already. – L-Four Feb 09 '17 at 13:14
  • Yes!, I have googled it and it says I need using System.Web.Mvc; But it is asking me to remove it (Then Remove Unnecessary Using) – Dev Feb 09 '17 at 13:17
  • @3spot answer from [here](http://stackoverflow.com/questions/26535131/system-web-mvc-missing) helped me. – Dev Feb 09 '17 at 13:24

1 Answers1

0

In order to make this work, you will need to follow these steps:

  1. Go to the NuGet PackageManager, and add MVC from Microsoft

MVC v5.2.3

  1. Change all ambiguous references from Compare to System.Web.Mvc.Compare.

  2. Remove the following line from the Web.config in your project root:

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

  3. Change the following lines in the project Root Web.config:

    <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

    <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

To these values (Note the Version change):

<add assembly="System.Web.Helpers, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
  1. Change the following lines in the project Root, Views folder, Web.config:

    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

    <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />

    <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />

To these values (Note the Version change):

<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" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
Kevin Mills
  • 408
  • 10
  • 15