Should I use AppDomain.CurrentDomain.BaseDirectory or System.Environment.CurrentDirectory?

前端 未结 7 1563
被撕碎了的回忆
被撕碎了的回忆 2020-11-28 04:28

I have two exe files in the same folder, I can run exe2 from a button in exe1. Today I was observing a customer over a remote (terminal services) session and exe2 failed to

7条回答
  •  醉话见心
    2020-11-28 04:59

    I usually use something like:

                string AppPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);
                AppPath = AppPath.Replace("file:\\", "");
    

提交回复
热议问题