FAQ - General

Question
C# Public Class Does Not Exist In the Current Context
Answer

In Visual Studio we have experienced a problem where a CSharp class created in the "App_Code" directory cannot be accessed in the code, despite the class being set as public.

In Visual Studio 2010, when creating a new class, by default, it's "Build Action" is set to "Content" instead of "Compile". This will mean that the class and it's methods will not be accessible in the code. Change the "Build Action" to "Compile" to fix this:

  1. Right click on your file
  2. Click "Properties"
  3. In the properties dialog, change "Build Action" to "Compile"

 Csharp public class not exist current context

If you found this information useful, please share it!


This FAQ was last updated on Tuesday, January 07, 2014

Contact Information

To find out more about Ava solutions you can contact us in a number of ways:
Follow Us...