自定义操作设置项目中的帮助
请给出您的想法:
在解决方案文件中,我有两个项目 PROJECTA 和 SETUP 项目。创建 PROJECTA 安装程序后,安装程序“example.msi”包含 PROJECTA.exe (或活动输出 )的项目。
安装“example.msi”时,我想在后台运行 PROJECTA.exe。
我尝试了自定义控件和安装程序类
如果给出了 exe 的路径(如下所示),则它可以正常工作。但这不是预期的行为,我希望在安装之前将 example.msi 中的 PROJECTA.exe 复制到该位置,以便我可以在安装过程中从那里运行。
如何才能实现这一点。
C# 语法:
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
string s="C:\\xxx\\PROJECTA.exe";
System.Diagnostics.Process.Start(s);
}
提前谢谢您。
Please give your ideas:
In a solution file ,I am having two projects PROJECTA and SETUP project. After creating the installer of PROJECTA , the installer "example.msi" contains PROJECTA.exe ( or active output
) of the PROJECTA .
While installing "example.msi", i want to run the PROJECTA.exe in the background.
I tried custom control and also installer class
If the path of the exe was given ( as shown below) , it works fine. but this is not the intended behaviour , i want PROJECTA.exe which is in example.msi to be copied to that location before installation , so that i can run from there during installation.
How this can be achieved .
C# Syntax :
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Install(IDictionary stateSaver)
{
base.Install(stateSaver);
}
[System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Demand)]
public override void Commit(IDictionary savedState)
{
base.Commit(savedState);
string s="C:\\xxx\\PROJECTA.exe";
System.Diagnostics.Process.Start(s);
}
Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将 PROJECTA.exe 设为 MSI 安装,然后将其添加到二进制表中。然后,如果要在 UI 序列中完成,则创建类型为 50 的 CustomAction;如果要在 exec 序列中完成,则创建类型 7。您无法在 .NET CA 中执行此操作,因为一次只允许运行 1 个 MSI 安装程序实例。通过运行嵌套安装程序,您基本上可以共享相同的 MSI 安装程序引擎实例
综上所述,嵌套安装程序可能会很痛苦,如果可以的话应该避免。
Make PROJECTA.exe a MSI install, then add it to your binary table. Then create a CustomAction of type 50 if it's going to be done in the UI sequence, or type 7 if it's going to be in the exec sequence. You can't do it in a .NET CA as you're only allowed to have 1 instance of a MSI installer running at a time. By running a nested installer you are basically sharing the same MSI installer engine instance
After saying all this, nested installers can be painful, and should be avoided if you can help it.