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

12

87

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.

Coherent answered 31/12, 2013 at 5:8 Comment(0)
G
173

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!

Gallipot answered 20/1, 2014 at 8:50 Comment(7)
A way how these files could get there is if in one of your deployments your publish settings included the setting 'Precompile during publishing'Makings
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?!Taskwork
After publishing using "Precompile" turned on solved this problemVilleinage
I've same problem, I removed app_global.asax.dll file from the bin. But how these files got in bin.Burgin
Could it be because PrecompiledApp.config is missing?Whimper
I had these files in Bin folder and a 'global.asax' file in root folder. I just deleted these files and problem solved! tnx.Shevat
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)Indiscrimination
O
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!

Oriel answered 31/12, 2013 at 5:26 Comment(1)
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.configNummular
C
11

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

Christ answered 23/12, 2016 at 13:38 Comment(1)
I wish there was additional explanation for this.Gegenschein
N
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.

Nummular answered 23/9, 2015 at 12:33 Comment(1)
this worked for me as well, whereas deleting the temp folder didn'tKistna
W
2

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

Warms answered 25/7, 2019 at 22:32 Comment(1)
how is this different than the accepted answer? (which btw predates this answer by years)Lyse
P
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...

Pother answered 13/5, 2021 at 15:21 Comment(0)
K
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

Karmakarmadharaya answered 8/5, 2019 at 20:6 Comment(0)
P
0

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

Porkpie answered 14/2, 2019 at 6:58 Comment(0)
D
0

I just Clean Solution and Build Solution then solved!

Denotative answered 2/10, 2019 at 11:9 Comment(0)
L
0

Interestingly, my case is the exact opposite of @IgorOkorokov.

This is an older wep service app with no CI/CD, we just publish to a local folder and copy the files to the server. (Don't judge me.)

The app folder on the server already had a PrecompiledApp.config. After publishing a new version of the app, attempting to call any of the API methods resulted in a 404 error until I removed this file.

My takeaway is that

  • if you check the Precompile during publish option when publishing the site, this file must be present in the app's root folder on the server;
  • if you do not check said option, this file must not be present in the app root folder.

... but like @ChriPF I'm willing to be further enlightened.

Lyse answered 28/9, 2023 at 20:53 Comment(0)
S
-1

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

enter image description here

Seacoast answered 22/4, 2018 at 13:55 Comment(2)
Is this an error description or a solution description?Lacagnia
Its solutions, Make sure you have added PrecompiledApp.config on root staging as wellSeacoast
B
-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

Balenciaga answered 10/1, 2019 at 10:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.