Asp.NET 2.0 Website Cannot Access Classes in App_Code

I had a problem accessing the class after deploying my site to the server. Please note that this is a website, not a web application. Error:

Compiler Error Message: CS0246: Could not find the name or namespace name "Order" (are you missing the using directive or assembly references?)

Version Information: Microsoft.NET Framework Version: 2.0.50727.1433; ASP.NET Version: 2.0.50727.1433

I did a lot of searches and could not find anything that helped.

My code looks like this (I get a compiler error on the line declaring Order):

//Default.aspx.cs
namespace Foo
{
    public partial class _Default : System.Web.UI.Page
    {
        private Order custOrder;
        ....etc
    }
}

In the App_Code folder, I have Order.cs:

namespace Foo
{
    public class Order
    {
        ....etc
    }
}

It is strange that this works fine locally and in the dev environment. When I go into qa environment, I get this error.

, subversion, .

, - , , , .

, , ? .net 2.0

+3
5

, , .

:

  • .cs app_code. ASP.NET , , , .

  • .cs app_code. , , .

  • .cs.

  • - , .cs .aspx, ..

, , .

+3

App_Code Build Action "Compile".

+16

bin SVN ( ), , ( ) VS App_Code.dll . , bin . , , ftp ..

+1

Is the Build Action property set to compile in your App_Code files? This is not the default in web application projects.

+1
source

Deploy dll file inside your .aspx file?

0
source

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


All Articles