Too many namespaces in Asp.Net? CS0234

Work on the Asp.Net project, adding a new control (ascx), starts in the strange problem CS0234. Basically, the compiler cannot find the full namespace. What makes him truly bizarre is that sometimes he can find him, and sometimes he cannot. Every time I make an assembly, it does not find it in different files. That is, sometimes he builds. Sometimes he finds it in files a and b, but not c and d. Sometimes it finds a namespace in a, b and c, but not d. And every other rearrangement.

Add a new control defined in the ClassName class (ClassName.ascx and ClassName.ascx.cs files).

Path: c: .. \ Project \ WebuserControls \ ControlType

Namespace - Project.WebUserControls.ControlType

During the whole project I call. Project.WebUserControls.ControlType.ClassName.SomeMethod();When I compile, I get the error "CS0234 The type or name of the Project.WebUserControls.ControlType namespace does not exist in the Project.WebUserControls class or namespace (do you miss the assembly link?), Although this is definitely exists in this namespace, and Intellisense cannot find a namespace or anything in it.

C # file has the form

namespace Project.WebUserControls.ControlType
{
    using System 
    ...etc
    public partial class ClassName : System.Web.UI.UserControl
    {

After much searching, I find this , which may lead to a solution.

In web.config:

<system.web>
    ...
    <pages>
        ... 
        <namespaces> 
            <add namespace="Project.WebUserControls" />

Interestingly, if I replaced namespace="Project.WebUserControls"with namespace="Project.WebUserControls.ControlType", it will not compile.

This fix works for about half an hour and several builds, but now has stopped working. No, I did not change any code to make it stop working.

Any ideas?


: ClassName, , , , , . , Project.WebUserControls c:..\Project\WebUserControls\

, . 255 .


... .

+3
2

, vstudio/IIS , / .

( vstudio) IIS

0

Visual Studio, #/.NET.

: - , , ?

0

Source: https://habr.com/ru/post/1775252/