如何在C#中的installerclass中获取msi路径

Dul*_*ttu 3 c# windows-installer managedinstallerclass

我想知道是哪里的路径msi位于whithin的InstallerClass,我如设置自定义操作使用.

我尝试使用类似的属性path,SrcDir在等Context.Parameters,但这些值不exsist(抛出NullReferenceException).是否有任何其他方式获得该路径或任何理由为什么这些值为空?

谢谢

Gra*_*mas 6

您需要通过VS中的Property窗口传递操作数据中的相关属性:

/sourceDir="[SourceDir]\"
Run Code Online (Sandbox Code Playgroud)

然后,使用上下文来检索它:

string path = Context.Parameters["SourceDir"];
Run Code Online (Sandbox Code Playgroud)