I found this blog post, suggesting to use Path.GetFileName(Environment.GetCommandLineArgs()[0])
. This returns something like YourProjectName.dll
. If needed, you can strip the file extension. Or even keep the entire path by omitting the call to Path.GetFileName
.