Parser Error Message: Could not load type 'sometype'
Could not load type
means that a type could not be loaded. (In this case, "type" refers to Inventory1.Global
). Types are located in compiled DLLs. So, either the DLL isn't available, is out of date, or doesn't contain a public
type with the given name.
Some possible causes are:
- You have no type declared with the given name. For your example, you should have the following:
namespace Inventory1 { public class Global { ... } }
Note: avoid names like Inventory1
. They imply that there is an Inventory2
, Inventory3
, etc., which is bad practice as they're abmiguous and not very descriptive. Also, Global
is pretty vague, and may introduce confusion with the global namespace.
- Make sure your cases match (
Inventory1
, notINVENTORY1
.) - You haven't compiled the project. In VS, rebuild the solution.
- The assembly that declares the class has a compilation error, so the relevant DLL is either missing or out of date. Make sure you've resolved all errors.
- The class is not marked as
public
.
If I had to guess, I'd put my money on a compilation error. Unlike PHP and other interpreted languages, C# have to be successfully compiled before they can be used.
Try replacing CodeBehind with CodeFile