PreApplicationStartMethod Attribute causes exception
- by Joop
Strange thing happening to me with the PreApplicationStartMethod Attribute. I did implement it in my latest project. In the AssemblyInfo.cs I have the following line:
[assembly: PreApplicationStartMethod(typeof(MyAssembly.Initializer), "Initialize")]
The Type and method look like this:
namespace MyAssembly
{
public static class Initializer
{
public static void Initialize()
{
TranslationKeys.Initialize();
}
}
}
When I rebuild my application and load it in the browser I get the following error:
The method specified by the PreApplicationStartMethodAttribute on assembly 'MyWebApp, Version=0.0.1.0, Culture=neutral, PublicKeyToken=null' cannot be resolved. Type: 'MyAssembly.Initializer', MethodName: 'Initialize'. Verify that the type is public and the method is public and static (Shared in Visual Basic).
I really have no idea what the problem is.