locked
Get executable using Reflection RRS feed

  • Frage

  • Hello together!

    I tried to get the executable at runtime.
    But I didn't get it work without the name, I just wanted something like:

    Assemlby.GetEntryAssembly()
    Unfortunately that is not available in the compact Framework.

    I tried:

    Assembly.GetExecutingAssembly()
    Assembly.GetCallingAssembly()
    But I only get the library in which the source code is and the the executable.

    Is there a way to get the Assembly of the executable, without knowing the name.

    Thanks in advance.

    Greetings
    Markus
    Dienstag, 26. Januar 2010 08:46

Antworten

  • Hello together!

    I didn't get it work and with the dll import and it is getting to complecated anyways.
    So I will just keep the name of the exe from the beginning and the access it using the name.

    Thanks.

    Markus
    • Als Antwort markiert Markus1982 Dienstag, 26. Januar 2010 15:55
    Dienstag, 26. Januar 2010 15:55

Alle Antworten

  • Hi

    try this

    System.Reflection.

    Assembly.GetExecutingAssembly().GetName().CodeBase;

    Regards
    Jörg

    • Als Antwort vorgeschlagen Jörg Dähler Dienstag, 26. Januar 2010 09:03
    Dienstag, 26. Januar 2010 08:52
  • Ohne Garantie: string executable = Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName;

    http://patrickgetzmann.spaces.live.com/blog
    Dienstag, 26. Januar 2010 08:53
  • Hello Jörg!

    Thanks for your reply, but I just get the dll and the exe.

    Greetings
    Markus
    Dienstag, 26. Januar 2010 09:28
  • Hello Patrick!

    Same thing, only the dll and not the exe.

    Thanks.

    Markus
    Dienstag, 26. Januar 2010 09:29
  • Hi,

    did you take a look at the first post from this thread ?

    Cheers, Peter
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Dienstag, 26. Januar 2010 10:55
  • Hello Peter!

    Thanks for your answer, already found this thread and I am trying this solution.

    I didn't post it so far, as I generally mind dllimports.

    If there would be another solution I would prefer it, but I am trying this solution and if it works I will post it in this thread.

    Greetings
    Markus
    Dienstag, 26. Januar 2010 13:16
  • Hello together!

    I didn't get it work and with the dll import and it is getting to complecated anyways.
    So I will just keep the name of the exe from the beginning and the access it using the name.

    Thanks.

    Markus
    • Als Antwort markiert Markus1982 Dienstag, 26. Januar 2010 15:55
    Dienstag, 26. Januar 2010 15:55