Find the location of my application's executable in WPF (C# or vb.net)?

前端 未结 7 1359
借酒劲吻你
借酒劲吻你 2020-12-08 04:02

How can I find the location of my application\'s executable in WPF (C# or VB.Net)?

I\'ve used this code with windows forms:

Application.ExecutablePat         


        
7条回答
  •  半阙折子戏
    2020-12-08 04:41

    Several alternatives:

    Directory.GetParent(Assembly.GetExecutingAssembly().Location)
    
    System.AppDomain.CurrentDomain.BaseDirectory
    

    Only in VB:

    My.Application.Info.DirectoryPath
    

提交回复
热议问题