Environment.CurrentDirectory is yielding unexpected results when running installed app

前端 未结 5 1939
既然无缘
既然无缘 2020-12-06 10:49

Background:

I built an installer for my app, and all my dll\'s and content files are getting correctly copied to the C:\\Program Files\\MyComp

5条回答
  •  醉话见心
    2020-12-06 11:21

    Since you said that your application is using WPF, you can use the code below instead of Application.StartupPath :

    String appPath = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
    

提交回复
热议问题