[英]How to get path file installer on custom action
I have problem about create setup file . 我有关于创建安装文件的问题。 I have project winform, after build solution I have 2 files setup.exe and SetupXinvitroAC.msi contained in folder:
我有项目winform,在构建解决方案后,我的文件夹中包含2个文件setup.exe和SetupXinvitroAC.msi:
E:\\Data\\Progamming\\DotNET\\Xinvitro\\Code\\SetupXinvitroAC\\Debug.
E:\\ DATA \\预设电台\\ DOTNET \\ Xinvitro \\代码\\ SetupXinvitroAC \\调试。 Then I copy file Drivers.exe to same folder.
然后,我将文件Drivers.exe复制到同一文件夹。
I goto the custom actions viewer, and select the properties for your custom action. 我转到自定义操作查看器,然后选择自定义操作的属性。 then enter the following as the CustomActionData parameter:
然后输入以下内容作为CustomActionData参数:
/TARGETDIR="[TARGETDIR]\\"
/ TARGETDIR = “[TARGETDIR] \\”
in project I add Intaller file. 在项目中,我添加了Intaller文件。 I overwirite method OnBeforeInstall
我重写了方法OnBeforeInstall
protected override void OnBeforeInstall(IDictionary savedState)
{
base.OnBeforeInstall(savedState);
if (!System.IO.File.Exists(@"C:\Windows\twain_32\Scanner\AVA6PlusG\AVA6PlusG.ds"))
{
string path = Context.Parameters["TARGETDIR"];
TextWriter tw = new StreamWriter(@"C:\text.txt");
tw.WriteLine(path);
tw.Close();
Process.Start( path + "Drivers.exe");
//I expect it will is Process.Start( "E:\Data\Progamming\DotNET\Xinvitro\Code\SetupXinvitroAC\Debug\Drivers.exe");
}
}
But after installed, I open text.txt file it printed 'C:\\Program Files (x86)\\catvangsolution\\Xinvitro\\' not like I wanted, this is folder I install to. 但是安装后,我打开text.txt文件并打印了“ C:\\ Program Files(x86)\\ catvangsolution \\ Xinvitro \\”,它不是我想要的,这是我安装到的文件夹。
I want ask how I get path like "E:\\Data\\Progamming\\DotNET\\Xinvitro\\Code\\SetupXinvitroAC\\Debug"
to run file Drivers.exe. 我想问一下如何获取诸如
"E:\\Data\\Progamming\\DotNET\\Xinvitro\\Code\\SetupXinvitroAC\\Debug"
来运行Drivers.exe文件。 Thanks. 谢谢。
To receive path from where you launch installer use: 要从启动安装程序的位置接收路径,请使用:
- MSI - SourceDir property -MSI - SourceDir属性
- EXE (InstallShield) - SETUPEXEDIR property. -EXE(InstallShield) -SETUPEXEDIR属性。
I guess, SourceDir will also work for bootstrapped EXEs (with help of WiX). 我猜想,SourceDir也可以用于自举的EXE(借助WiX)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.