Organizing classes in the namespace in the App_Code folder does not work properly

I have several classes that I created for my web project, and I'm going to store them in the App_Code folder. I do not want to store all classes at the top level (without a namespace), but I want to organize them into namespaces. This is not yet possible, because when I use "use xxxx"; the namespace operator still cannot find the class in my code behind the files. What can i do wrong?

EDIT:

So for example, I have

namespace foo
{
    public class bar
    {
    }
}

Then in my code behind the page for default.aspx I have

.
.
.
using foo

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        bar NewBar = new bar();
    }
}

The above does NOT work for me. I have to use

foo.bar NewBar = new foo.bar();

Does anyone know what I'm doing wrong?

EDIT: , Visual Studio 2005 SP 1 -, -. STILL .

+3
8

. . . , , . , , .

+1

( ) .

+11

, -.

+3

namespace blah
{
   ...
}

?

+1

-, -. - .cs ( App_Code) " ", -, . DLL, (.. ). , -. , -. dll bin.

+1

, "" ?

0

VS2005, , , using, - .

, - / . , " -"?

, , ? ? ? ?

0

Right-click on "class" and select-> "property" by changing the property "to-> compile and on th.aspx" write the namespace name "

 using namespace name of the class;

It works great.

0
source

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


All Articles