Parser Error Message: Could not load type 'sometype'

前端 未结 19 1816
情话喂你
情话喂你 2020-12-09 15:46

I am experiencing an error that I am unable to resolve for some time now. I was wondering if someone can help identify the cause of this error? I am completely new to asp /

19条回答
  •  -上瘾入骨i
    2020-12-09 16:02

    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, not INVENTORY1.)
    • 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.

提交回复
热议问题