85

I have just integrated another project pages and its dlls into my existing project's Bin/ folder. My project framework is 3.5. When i am trying to build the project or solution, it's throwing following error:

"The type 'ASP.global_asax' exists in both 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\timesheet\15a75c54\898b48b9\assembly\dl3\58b062b2\00ceda54_c98cc801\App_global.asax.DLL' and 'c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\timesheet\15a75c54\898b48b9\App_global.asax.q_h6dbfx.dll' c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\timesheet\15a75c54\898b48b9\App_Web_admin.master.fdf7a39c.zecazgwd.0.cs "

Setting "batch=false" into web.config's is not working. I have also tried to delete all folders from "c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\", then clean and rebuild soultion. But still it's not working.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
KomalJariwala
  • 1,977
  • 3
  • 23
  • 32

11 Answers11

170

In my case the problem occurred in a virtual application's bin folder. Looking into this bin-folder you will probably see two files (an information I found here):

  • App_global.asax.dll
  • App_global.asax.compiled

Removing these resolves the error. The App_global.asax.dll is generated at runtime too which causes the problem. I am however still investigating how these files got there, so comments are definitely welcome!

ChriPf
  • 2,700
  • 1
  • 23
  • 25
  • 25
    A way how these files could get there is if in one of your deployments your publish settings included the setting 'Precompile during publishing' – BornToCode Jul 23 '14 at 08:36
  • 1
    In my case the Precompile during publishing option was already turned off. After deleting the files they didn't come back and the website started working again. Turning the 'Precompile' on caused the files to be generated... but the website then continued to work?! – Chris Nevill Jul 17 '15 at 11:40
  • 3
    After publishing using "Precompile" turned on solved this problem – Joe 89 Jan 23 '17 at 08:45
  • I've same problem, I removed app_global.asax.dll file from the bin. But how these files got in bin. – M2012 May 31 '17 at 10:51
  • 1
    Could it be because PrecompiledApp.config is missing? – Anders Kjeldsen Sep 05 '17 at 08:16
  • I had these files in Bin folder and a 'global.asax' file in root folder. I just deleted these files and problem solved! tnx. – Moslem Hadi Jan 20 '18 at 10:12
  • If by doing all these, you're still having the same issue, look at the references of your project. You might have a reference to that problematic dll which you need to remove. (Mine was a reference to App_Web_506b2eef.y07ibuiq) –  Mar 20 '18 at 13:27
13

I suggest you go to the path: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files and clear the all the temporary files of your application, build your solution, and then run it!

Dalorzo
  • 19,834
  • 7
  • 55
  • 102
The Hungry Dictator
  • 3,444
  • 5
  • 37
  • 53
  • 3
    As far as I can see, the author has tried this and it doesn't work. FWIW I have the same problem as the OP and deleting temp-files doesn't work, neither does setting batch=false in web.config – Morten Jensen Sep 23 '15 at 12:04
8

In my case the problem was caused by accidentional removal of "PrecompiledApp.config". As soon as i returned the file everything started working normally.

Igor Okorokov
  • 913
  • 1
  • 8
  • 15
4

I struggled with this issue in .NET 4.5 in VS2013 for a while before finding a solution that worked:

  • Manually deleting the contents of the ASP.Net project's bin-folder. Clean/Rebuild was insufficient. It didn't delete enough apparently ;)

The error persisted after adding the batch="false"attribute in the compilation-element of web.config.

It also did not help to delete the ASP.Net Temporary Files-directory either.

Morten Jensen
  • 5,818
  • 3
  • 43
  • 55
3

In my case, i have added in my folder bin a file with name "App_global.asax.compiled" delete only this files and its work.

View Image

Yehor Androsov
  • 4,885
  • 2
  • 23
  • 40
2

What worked for me was

Remove the TARGET BIN folder or empty that folder completely, and then put the newest version of your BIN folder.

Why: In my case after publishing the BIN folder to my "hosting provider" FTP server, the BIN folder was not overwriting the files that needed NOT to be there in this case those mentioned above App_global.asax.dll App_global.asax.compiled

SO by overwriting the whole BIN folder, we assure that the BIN folder is a brand new

this worked for me...

GeraGamo
  • 226
  • 3
  • 6
1

In my case, to solve the problem, I needed to disable the "PrecompileBeforePublish" and delete the bin folder as the image below.

step by step to set

Yehor Androsov
  • 4,885
  • 2
  • 23
  • 40
Genivan
  • 171
  • 2
  • 3
  • 10
0

My problem was I referenced .net standard project on my .net framework project, not sure where it got conflicted.

TPG
  • 2,811
  • 1
  • 31
  • 52
0

I just Clean Solution and Build Solution then solved!

Steven Yu
  • 135
  • 1
  • 12
-1

In my case I have added DLL from local to stage site.This works for me.

enter image description here

Muhammad Bilal
  • 1,008
  • 13
  • 14
-1

Have got recently the same error when publishing site from debug PC onto the server. Changing option to true solved the issue.

<DeleteExistingFiles>True</DeleteExistingFiles>

file ~\Properties\PublishProfiles\FolderProfile.pubxml