I have a ASP.NET MVC application using MVC 5 installed through Nuget packages.
Packages.config file
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ActionMailerNext" version="3.2.0.0" targetFramework="net45" />
<package id="ActionMailerNext.Mvc5" version="3.2.0.0" targetFramework="net45" />
<package id="Antlr" version="3.4.1.9004" targetFramework="net45" />
<package id="bootstrap" version="3.0.3" targetFramework="net45" />
<package id="CsQuery" version="1.3.4" targetFramework="net45" />
<package id="EntityFramework" version="6.1.3" targetFramework="net45" />
<package id="jQuery" version="1.10.2" targetFramework="net45" />
<package id="jQuery.Validation" version="1.11.1" targetFramework="net45" />
<package id="Mandrill" version="1.2.7.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Cors" version="5.0.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.Core" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.EntityFramework" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.Owin" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.AspNet.Identity.Samples" version="2.1.0-alpha1" targetFramework="net45" />
<package id="Microsoft.AspNet.Mvc" version="5.1.3" targetFramework="net45" />
<package id="Microsoft.AspNet.Razor" version="3.1.2" targetFramework="net45" />
<package id="Microsoft.AspNet.Web.Optimization" version="1.1.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi" version="5.2.2" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Core" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.Owin" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebApi.WebHost" version="5.2.3" targetFramework="net45" />
<package id="Microsoft.AspNet.WebPages" version="3.1.2" targetFramework="net45" />
<package id="Microsoft.jQuery.Unobtrusive.Validation" version="3.1.2" targetFramework="net45" />
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
<package id="Microsoft.Owin.Cors" version="3.0.0" targetFramework="net45" />
<package id="Microsoft.Owin.Host.SystemWeb" version="3.0.1" targetFramework="net45" />
<package id="Microsoft.Owin.Security" version="3.0.1" targetFramework="net45" />
<package id="Microsoft.Owin.Security.Cookies" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security.Facebook" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security.Google" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security.MicrosoftAccount" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Owin.Security.OAuth" version="3.0.1" targetFramework="net45" />
<package id="Microsoft.Owin.Security.Twitter" version="2.1.0" targetFramework="net45" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net45" />
<package id="Modernizr" version="2.6.2" targetFramework="net45" />
<package id="OpenTok" version="2.3.0" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="PreMailer.Net" version="1.3.1" targetFramework="net45" />
<package id="Respond" version="1.2.0" targetFramework="net45" />
<package id="RestSharpSigned" version="105.0.1" targetFramework="net45" />
<package id="Sendgrid" version="5.1.0" targetFramework="net45" />
<package id="SendGrid.SmtpApi" version="1.2.1" targetFramework="net45" />
<package id="WebGrease" version="1.5.2" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
</packages>
web.config file
<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<configSections>
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="PreserveLoginUrl" value="true" />
<add key="UserLockoutEnabledByDefault" value="true" />
<add key="DefaultAccountLockoutTimeSpan" value="1" />
<add key="MaxFailedAccessAttemptsBeforeLockout" value="3" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
<add key="owin:AppStartup" value="IdentitySample.Startup,InnerHour" />
<add key="NewProfileImagePath" value="http://innerhour.alightsoftwares.com/ProfileImage/" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<customErrors mode="Off"/>
<httpRuntime targetFramework="4.5" maxRequestLength="1012000"/>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers></system.webServer>
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
<parameters>
<parameter value="v11.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security.OAuth" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.0.1.0" newVersion="3.0.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Views folder web.config
<?xml version="1.0"?>
<configuration>
<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" 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" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<pages pageBaseType="System.Web.Mvc.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization"/>
<add namespace="System.Web.Routing" />
</namespaces>
</pages>
</system.web.webPages.razor>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<add path="*" verb="*" type="System.Web.HttpNotFoundHandler"/>
</httpHandlers>
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<controls>
<add assembly="System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<remove name="BlockViewHandler"/>
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
</handlers>
</system.webServer>
</configuration>
Inside .csproj file i have checked all the versions for MVC, webpages, razor are pointing to correct versions.Also i created a new empty mvc5 app and compared the csproj files and found some differences.
My MVC 5 project's csproj file has the below lines extra for dlls in the include directive which are not part of newly created MVC5 webapp.
When i build the solution the MVC version is always 4.0 and the references is referred from the bin folder instead of the packages folder where system.web.mvc with version 5.1.0 is lying and other references are failing which are dependent on MVC 5 instead of MVC 4. I know that for MVC5 system.web.mvc need not to be in GAC for referencing.
This project is delivered to me by outsourced team so i am completely clueless what could have gone wrong.
I am using windows 7 os and visual studio 2015 community version.
<Content Include="bin\ActionMailerNext.dll" />
<Content Include="bin\ActionMailerNext.Mvc5.dll" />
<Content Include="bin\Antlr3.Runtime.dll" />
<Content Include="bin\CsQuery.dll" />
<Content Include="bin\EntityFramework.dll" />
<Content Include="bin\EntityFramework.SqlServer.dll" />
<Content Include="bin\InnerHour.dll" />
<Content Include="bin\InnerHour.pdb" />
<Content Include="bin\Mandrill.dll" />
<Content Include="bin\MCPG.CCA.Util.dll" />
<Content Include="bin\Microsoft.AspNet.Identity.Core.dll" />
<Content Include="bin\Microsoft.AspNet.Identity.EntityFramework.dll" />
<Content Include="bin\Microsoft.AspNet.Identity.Owin.dll" />
<Content Include="bin\Microsoft.Owin.dll" />
<Content Include="bin\Microsoft.Owin.Host.SystemWeb.dll" />
<Content Include="bin\Microsoft.Owin.Security.Cookies.dll" />
<Content Include="bin\Microsoft.Owin.Security.dll" />
<Content Include="bin\Microsoft.Owin.Security.Facebook.dll" />
<Content Include="bin\Microsoft.Owin.Security.Google.dll" />
<Content Include="bin\Microsoft.Owin.Security.MicrosoftAccount.dll" />
<Content Include="bin\Microsoft.Owin.Security.OAuth.dll" />
<Content Include="bin\Microsoft.Owin.Security.Twitter.dll" />
<Content Include="bin\Microsoft.Web.Infrastructure.dll" />
<Content Include="bin\Newtonsoft.Json.dll" />
<Content Include="bin\OpenTok.dll" />
<Content Include="bin\Owin.dll" />
<Content Include="bin\PreMailer.Net.dll" />
<Content Include="bin\RestSharp.dll" />
<Content Include="bin\SendGrid.SmtpApi.dll" />
<Content Include="bin\SendGridMail.dll" />
<Content Include="bin\System.Net.Http.Formatting.dll" />
<Content Include="bin\System.Web.Helpers.dll" />
<Content Include="bin\System.Web.Http.dll" />
<Content Include="bin\System.Web.Http.WebHost.dll" />
<Content Include="bin\System.Web.Mvc.dll" />
<Content Include="bin\System.Web.Optimization.dll" />
<Content Include="bin\System.Web.Razor.dll" />
<Content Include="bin\System.Web.Webpages.Deployment.dll" />
<Content Include="bin\System.Web.Webpages.dll" />
<Content Include="bin\System.Web.Webpages.Razor.dll" />
<Content Include="bin\WebGrease.dll" />