【发布时间】:2016-10-20 14:26:07
【问题描述】:
我的setup.exe在e:\setup.exe中,我试过这段代码:
System.AppDomain.CurrentDomain.BaseDirectory;
返回 c:\Windows\syswow64\
Application.ExecutablePath;
返回 c:\Windows\syswow64\MsiExec.exe
Application.StartupPath
返回 c:\Windows\syswow64\
我需要一些东西返回 e:\
【问题讨论】:
-
你可以使用
Directory.GetCurrentDirectory()获取当前正在运行的进程目录,你也可以使用DriveInfo[] allDrives = DriveInfo.GetDrives();获取所有驱动器,如果你正在寻找的话 -
问题在于,在您的代码运行时,它作为
.msi文件的一个组件运行,正如大多数迹象告诉您的那样,该文件实际上是由@987654327 执行的@ 程序。如果有一种访问此信息的方法,您将寻找特定于访问 MSI 属性的 MSI,而不是查看当前可执行文件/工作目录的通用 .NET 代码。
标签: c# windows installation