I am running a solution which contains different projects. However, i am trying to run a project (class library) which contains wcf services using Visual Studio 2015 and framework 4.6 (on windows 8 OS, IIS Express). However it keeps showing this error in the browser:
Error:
I noticed that the calling assembly of Razor 2.0 is "System.Web.Mvc" Version 4.0.0.1:
Calling assembly : System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35.
However, System.Web.MVC dll is not referenced in this project, the references in the project are in the image below:
Although, it is not referenced it always appears in the bin folder, even when i clear it. And may be that's why it is trying to call "System.Web.WebPages.Razor" version 2.0.
Clarifying any clues of the problem:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<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="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<packages>
<package id="EntityFramework" version="6.1.3" targetFramework="net46" />
<package id="Microsoft.AspNet.Providers" version="2.0.0" targetFramework="net451" />
<package id="Microsoft.AspNet.Providers.Core" version="2.0.0" targetFramework="net451" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net46" />
<package id="PostSharp" version="4.3.5-alpha" targetFramework="net46" />
<package id="System.Web.Providers" version="1.2" targetFramework="net451" />
</packages>
I am wondering about whats going on? may another project affects it! Also i have tried to use nugget to update the packages (uninstalled and reinstalled), but still in the same situation.
A possible reason of the problem:
I also noticed there is a "Gobal.asax" file in this project which uses "MvcApplication" class that implements "System.Web.HttpApplication" which may be a good reason of the problem.
Any help is appreciated.
Solution: install Microsoft.AspNet.Webpages first release of version 2.0 via nuget manager.