Question

I upgraded my MVC 4 appliction to the latest version MVC 5 , EF 6, .net framework 4.5.1, VS 2013. Every thing seems to be working fine in my local machine.

I publish the code to Dev environment. The Dev machine has Windows Server 2008 R2 and .net framerwork 4.5.2. When I try to run the application in dev I am getting the following error.

CS0433: The type 'System.Web.WebPages.HelperPage' exists in both 'c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\mlsreports\aa2013e5\8814ccd8\assembly\dl3\b5d609a0\2a002cc3_166bcf01\System.Web.WebPages.DLL' and 'c:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Web.WebPages\v4.0_1.0.0.0__31bf3856ad364e35\System.Web.WebPages.dll'

I have tried deleting all the files in Temporary ASP.NET files. But that didn't help. how might I be able to fix this?

Any pointers please.

In my local machine :

In Solution Explorer, I Unloaded Project and selected Edit ProjectName.csproj.

Located the assembly references I see :

 <Reference Include="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
          <SpecificVersion>False</SpecificVersion>
          <HintPath>..\packages\Microsoft.AspNet.WebPages.3.1.2\lib\net45\System.Web.WebPages.dll</HintPath>
Was it helpful?

Solution

I'd bet that it's because your MVC project has more than one reference to System.Web.WebPages. Removing one of them should solve that problem.

By the way, the Temporary ASP.NET folder is just that, temporary. Even though your error references that path, deleting files from that folder is useless. They will just be copied there again when IIS runs another request, or break the entire site until restart IIS.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top