[英]Does not give the relative domain path after application release C#
I have a class library and windows forms library. 我有一个类库和Windows窗体库。 In my class library, i have used, for an example,
AppDomain.CurrentDomain.BaseDirectory+"ffmpeg.exe"
to access ffmpeg in the current path as a process. 在我的类库中,例如,我使用
AppDomain.CurrentDomain.BaseDirectory+"ffmpeg.exe"
作为进程访问当前路径中的ffmpeg。 But after releasing the executable files, FFmpeg.exe doesn't run. 但是在释放可执行文件后,FFmpeg.exe无法运行。 I have tried
System.IO.Directory.GetCurrentDirectory()
and ( new System.Uri(Assembly.GetExecutingAssembly().CodeBase) ).AbsolutePath;
我已经尝试了
System.IO.Directory.GetCurrentDirectory()
和( new System.Uri(Assembly.GetExecutingAssembly().CodeBase) ).AbsolutePath;
and more options. 和更多选项。 Nothing worked
什么都没做
Try something like this: 尝试这样的事情:
Process process = Process.GetCurrentProcess();
ProcessModule module = process.MainModule;
string dir = Path.GetDirectoryName(module.FileName);
string ffmpeg_path = Path.Combine(dir,"ffmpeg.exe");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.