In my ASP.NET project, I have an App_Code folder.
In the folder are several classes that work perfectly fine. The classes can see each other without any problems.
I have also added an Enums.cs file to the folder. The Enums.cs file contains the following code:
namespace xsite.App_Code
{
public enum Bottle
{
Glass,
Plastic,
Paper
}
}
Problem is that none of the classes in the folder can use the Bottle enum. When I try to use the enum, I get the following error:
The type or namespace name ‘Bottle’ could not be found (are you missing a using directive or an assembly reference?)
The namespace of the classes in the folder is the same as the enum.
Any idea how I can fix this, so I can use the Bottle enum?
If you could not access the enum by xsite.App_Code.Bottle then you have to check the properties of the file. Right click the file and take properties. There will be a property called
Build Action, set it toCompile.