How to get the location of the DLL currently executing?

后端 未结 5 1538
情话喂你
情话喂你 2020-11-29 04:38

I have a config file that I need to load as part of the execution of a dll I am writing.

The problem I am having is that the place I put the dll and config file is n

5条回答
  •  失恋的感觉
    2020-11-29 04:44

    In my case (dealing with my assemblies loaded [as file] into Outlook):

    typeof(OneOfMyTypes).Assembly.CodeBase
    

    Note the use of CodeBase (not Location) on the Assembly. Others have pointed out alternative methods of locating the assembly.

提交回复
热议问题