简体   繁体   English

WIX安装程序无法正确运行C#进程

[英]WIX Installer do not run C# process properly

We have a big WIX Installer. 我们有一个很大的WIX安装程序。 After the installation, there are around 2800 scripts that should be run to upgrade the database. 安装后,应运行大约2800个脚本来升级数据库。 For that purpose, a special application is created. 为此,创建了一个特殊的应用程序。 It just goes to the SQL machine, installs prerequisites like SQL SMO and SQL Sys Clr Types, and executes scripts. 它只是进入SQL机器,安装SQL SMO和SQL Sys Clr类型之类的先决条件,并执行脚本。 This small application is run in custom actions in WIX. 这个小应用程序在WIX中以自定义操作运行。 Logically, it should be run with elevated privileges. 从逻辑上讲,它应该以提升的特权运行。 In this custom action, I am using c# Processes to start the app. 在此自定义操作中,我正在使用c#进程来启动应用程序。 However, I have tried everything, and the application is still not working properly. 但是,我已经尝试了一切,但该应用程序仍无法正常工作。 It opens the app and app tries to install prerequisites and just exits - nothing is installed. 它将打开应用程序,并且该应用程序尝试安装必备软件,然后退出-未安装任何内容。 What I have tried: 1. Running process with elevated privileges (process.StartInfo.UseShellExecute = true) 2. Running process with user privileges (standardinput/output with UseShellExecute=false) 3. Running the app with a batch file. 我尝试的操作:1.以提升的特权运行进程(process.StartInfo.UseShellExecute = true)2.以用户特权运行进程(UseInputExecute = false的standardinput / output)3.使用批处理文件运行应用程序。

Overall process should be as following: Installer is run with elevated privileges -> After installation, special application is run to upgrade the database -> the app installs prerequisites -> the app executes scripts. 总体过程应如下:以提升的特权运行安装程序->安装后,将运行特殊的应用程序以升级数据库->应用程序先决条件->应用程序执行脚本。

The interesting part is that application is working properly when I do it manually with cmd. 有趣的是,当我使用cmd手动执行应用程序时,该应用程序可以正常工作。 However, when installer's custom action opens cmd.exe (c# Process) and it is still waiting, then manually opening application via cmd is not working. 但是,当安装程序的自定义操作打开cmd.exe(c#进程)并且仍在等待时,则无法通过cmd手动打开应用程序。 In other words, I have cmd (with elevated rights) opened by installer and another cmd opened by myself manually. 换句话说,我已经由安装程序打开了cmd(具有提升的权限),而我自己手动打开了另一个cmd。 Then, manual running the application is not working. 然后,手动运行该应用程序不起作用。 As soon as I close the cmd opened by the installer, and run manually the application via cmd that was opened by myself, then again everything is fine, everything is working. 一旦我关闭了安装程序打开的cmd,并通过自己打开的cmd手动运行了应用程序,那么一切都很好,一切都正常了。

I need a help how can I fix this? 我需要帮助我该如何解决?

PS The installer's prerequisites cannot be extracted and installed separately. PS无法单独提取和安装安装程序的先决条件。 We do not have source code of upgrade database application. 我们没有升级数据库应用程序的源代码。

经过一番研究,我发现Windows无法同时运行两个MSI,因此第二个MSI默默退出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM