开发者

why .net framework conflicts with its own generated file

开发者 https://www.devze.com 2023-03-25 16:21 出处:网络
I face with an error many times I need some guide to solve it for ever: Compilation Error Description: An error occurred during the compilation of a

I face with an error many times I need some guide to solve it for ever:

Compilation Error

Description: An error occurred during the compilation of a

resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0433: The type

'ASP.controls_sites_linkbox_ascx' exists in both 'd:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\marja\8d9a6443\9cb45dad\App_Web_1hpsmwqz.dll' and 'd:\Windows\Micr开发者_Go百科osoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\marja\8d9a6443\9cb45dad\App_Web_4lhnbswq.dll'

the problem will be solved when I close the visual studio. but it is not normal isn't it dangerous when we published application on the server it might be appear again and again ?


If you don't want to run into this problem, avoid "Web Site" projects if you can - and favour "Web applications".

Really, a "Web Site" project is just a regular web application, with one key difference. Instead of having a named .dll for your application ( e.g. Something.Web.dll ), the name of your assembly is auto-genned ( in your case, App_Web_1hpsmwqz.dll ).

Now, your problem stems from the fact that this has happened a couple of times, and you've got an older auto-generated file kicking around - which is still in your app's dll search path. So the compiler ends up finding two classes with the exact same namespace. It doesn't know which to pick.

You can do as Ankur suggests, and delete the temporary files. Long-term, I'd consider turning this into a proper web application.

I did one, and precisely one "Web Site". I hit this problem a couple of times and resolved that I'd never do one again. Moved back to web applications and (obviously) never had the problem again.


  • Go to "d:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\"
  • Delete all files.
  • Then try rebuilding the project.
0

精彩评论

暂无评论...
验证码 换一张
取 消