Compilation Error: The type 'ASP.global_asax' exists in both DLLs
C#asp.net.NetDllC# 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
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.
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.
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#
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