C# module entry point

I’ve made a C# Web Service. Now I need a deployment project for my Web Service. After installing, it turns out that my Web Service needs to set the security on a registry key to allow the ASPNET user Full Control. Fine. I’ll need some sort of hand-written code to do that, because security is something the installer doesn’t cover. Stumbling around the help and web, I find I need to View | Editor | Custom Actions to create a Custom Action (right-click On the Install event/action, select Primary Output from JoshsPrimaryOutput; on the properties of this new Custom Action set InstallerClass to false and set EntryPoint to JoshsEntryPointFunction). Build.

I get the error:

Unspecified module entry point for custom action ‘<name>’ in JoshsPrimaryOutput.dll

Which the help… helpfully tells me to fix it I need to

…specify a valid entry point within the DLL.

Fine, makes sense. I’m not stoopid, I’ve been a C++/Windows programmer for a very long time. I know DLLs, I know entry points, this holds no fear for me. C# has DLLimport. It seems to be missing DLLexport. I’ve just spent several hours searching online help and the web for an answer, so now I turn to you, our esteemed readers.

How do I specify a module entry point in C#?

4 thoughts on “C# module entry point

  1. Trav

    Maybe I’m oversimplifying this a bit, but I thought entry points in C# had to be called Main.

    They must be static, can return void or an int, and can accept no paramters, or a string array:

    static void Main(){}
    static int Main(){}
    static void Main(string[] args){}
    static int Main(string[] args){}

    -Trav

  2. Dino

    As far as I am aware, installer classes can only be used with EXEs 🙁

    But when you figure it out, let me know 🙂

  3. josh Post author

    I’ve followed the instructions as per the help for /main to specify the location of main, and (intentionally) put into my class both:
    public static void Main(){}
    public static void Main(string[] a){}
    hoping to generate error CS0017 – positive feedback that it noticed what I’d done and that it knew what I intended the functions for – and I’d have to pick one.

    No error.

    Not there. But it still can’t find the entry point.

  4. glen

    It may not have an entry point (as DUMPBIN) defines it.

    This isn’t an actual dll, it’s an MSIL which is interpreted by the .Net framework runtime. C++ dlls are compiled into machine-native code, .Net exes and dlls are not.

    This might be a red herring, but I’m not convinced DUMPBIN is going to like your .Net dlls

Comments are closed.