Compilation Error: The type 'ASP.global_asax' exists in both DLLs

C#asp.net.NetDll

C# Problem Overview


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.

C# Solutions


Solution 1 - C#

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!

Solution 2 - C#

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!

Solution 3 - C#

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

Solution 4 - C#

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.

Solution 5 - C#

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

Solution 6 - C#

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

Solution 7 - C#

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...

Solution 8 - C#

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

Solution 9 - C#

I just Clean Solution and Build Solution then solved!

Solution 10 - C#

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

enter image description here

Solution 11 - C#

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionKomalJariwalaView Question on Stackoverflow
Solution 1 - C#ChriPfView Answer on Stackoverflow
Solution 2 - C#The Hungry DictatorView Answer on Stackoverflow
Solution 3 - C#Igor OkorokovView Answer on Stackoverflow
Solution 4 - C#Morten JensenView Answer on Stackoverflow
Solution 5 - C#GenivanView Answer on Stackoverflow
Solution 6 - C#Inaki QuinteroView Answer on Stackoverflow
Solution 7 - C#GeraGamoView Answer on Stackoverflow
Solution 8 - C#TPGView Answer on Stackoverflow
Solution 9 - C#Steven YuView Answer on Stackoverflow
Solution 10 - C#Muhammad BilalView Answer on Stackoverflow
Solution 11 - C#Vladimir ZakharenkovView Answer on Stackoverflow