Im new to c# and im creating a new web app. As usual i create a library of public functions used by the application in general.
Im using VS.net 2008, I created a project new projectwith the followin structure: root --App_Code globalClass.cs --scripts Default.aspx Default.aspx.cs
I need to import/using the globalClass inside App_Code/globalClass.cs Inside the code Behind of Default.aspx or any other.
This is the content of App_Code/globalClass.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
namespace sgmedcs.globalClass
{
public class claseGlobalX : System.Web.UI.Page
{
//HttpContext httpActual = HttpContext.Current;
public string cargarSQL(string queryStr, string queryType)
{
//Scripting
}
}
}
I also used as namespace sgmed.App_Code.globalClass and sgmedcs.AppCode.globalClass
On the Default.aspx.cs i added using sgmedcs.globalClass; Or using sgmed.App_Code.globalClass; Or using sgmedcs.AppCode.globalClass
All of these approaches gives me "The type or namespace name 'claseGlobal' does not exist in the namespace 'sgmedcs' (are you missing an assembly reference?)"
What im missing, thanks for the help.
Go into the properties of the class, and change the Build Action to Compile
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With