开发者

Error CS0433 : ascx exists in two DLLs

开发者 https://www.devze.com 2023-04-01 02:57 出处:网络
In my case I have in the root folder (/ of my project) a class Ten.class that I use in various .cs files.

In my case I have in the root folder (/ of my project) a class Ten.class that I use in various .cs files.

When I precompile my application I get no errors. When I call X.aspx call a browser I g开发者_JS百科et an error since the code for X.aspx.cs is contained in both App_Web_xqlu1c5t.dll and TenManager.dll (TenManager is the namespace).

Compiler Error Message:

CS0433: The type 'ASP.usercontrols_contenteditor_ascx' exists in both 'App_Web_xqlu1c5t.dll' and 'TenManager.dll'

If I convert this web site into a web application and I select "Publish Site" all the code is compiled in TenManager.dll.

How to solve it?


One solution would be to delete all files from the root folder path. On Windows 7:

c:\Users\{username}\AppData\Local\Temp\Temporary ASP.NET Files\root\

If that doesn't work then delete the temporary dll file from the path

c:\Users\{username}\AppData\Local\Temp\Temporary ASP.NET Files\application_name\

as it will be rebuilt when you compile the app.


Does this look like the issue at hand?

The type TypeName1 exists in both TypeName2 and TypeName3 Two different assemblies referenced in your application contain the same namespace and type, which produces ambiguity.

To resolve this error, use the alias feature of the /reference (Import Metadata) (C# Compiler Options) compiler option or do not reference one of your assemblies.


Try to search for "usercontrols_contenteditor_ascx" in entire solution for any duplicates. Sometimes if you copy usercontrol or page and do not change class name it will show this error.

If there are duplicates you need to change class name of one of them

0

精彩评论

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

关注公众号