8

this has been answered on different forums, but i have tried all the solution none of them works

this is what i have tried so far

  1. added batch="false" attribute within compilation section of the web.config

  2. removed App_global.asax.dll file from bin

  3. removed temp files from C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files- although they keep getting generated

  4. did clean and re build solution

Error : the type 'ASP.global_asax' exists in both

'c:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\root\00fc2357\712b6e00\assembly\dl3\ffed6c98\9dede25f_09c2cf01\SLIC.Website.Deployment.DLL' 
and 'c:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files\root\00fc2357\712b6e00\App_global.asax.y_m8p2iy.dll'


protected ASP.global_asax ApplicationInstance {
Line 23:         get {
Line 24:             return ((ASP.global_asax)(this.Context.ApplicationInstance));
Hakan Zim
  • 305
  • 1
  • 5
  • 15
  • normally, just right click in your solution and choose `Clean` and then, right click and choose `Re-Build`... – balexandre Sep 30 '14 at 16:20
  • Tried that with no luck but thanks for pointing that out ill amend my question to reflect that step – Hakan Zim Sep 30 '14 at 16:25
  • close Visual Studio, manually delete the folder `c:\Users\username\AppData\Local\Temp\Temporary ASP.NET Files` and try again – balexandre Sep 30 '14 at 16:38
  • then you have some duplicated file somewhere in the project... something that tries to compiled twice... for the looks of it, inside your project `SLIC.Website.Deployment` there's the same namespace/file... it's the only thing it come to my head... sorry. – balexandre Sep 30 '14 at 16:43
  • Is this a website project or web app project? Can you create a fresh project and add the files and see? I believe what ever you did made the compiler think it is both web app and website project. – Ramesh Oct 01 '14 at 02:07
  • 4
    a solution that worked for me is right here: http://stackoverflow.com/questions/20852039/compilation-error-the-type-asp-global-asax-exists-in-both-dlls – thegreatgiver Aug 18 '15 at 15:54
  • possible duplicate of http://stackoverflow.com/questions/20852039/compilation-error-the-type-asp-global-asax-exists-in-both-dlls – Squazz Sep 23 '16 at 08:08

4 Answers4

7

Try checking you publish settings. It might include the setting Precompile during publishing.

In the cases where I have experienced this, disabling this in my publish settings was the solution.

Squazz
  • 3,912
  • 7
  • 38
  • 62
4

Kindly remove below files from bin folder. App_global.asax.dll App_global.asax.compiled

Surinder Singh
  • 161
  • 2
  • 2
3

Here is another solution,

In your ISS virtual directory delete the BIN folder, then clean and rebuild your project and make new build/publish.

This solution is work for me using ASP.NET MVC 5, Entity Framework 6, Framework 4.6 and IIS 7.

Tahir Alvi
  • 896
  • 2
  • 14
  • 44
0

The problem in my case was as follows

  1. I was publishing to a local folder, which no problem at this point but
  2. after uploading my "published" release version of my APP to the FTP server "hosting provider" the pre existing BIN folder on that FTP folder was not wiped out or removed, so all the files on that target folder remain with the old BIN version

SO my solution was Emptied the target BIN folder, and then put the bran new one there

Hope it helps to anyone around here...

GeraGamo
  • 226
  • 3
  • 6