请您告知我如何使用WiX MSI安装程序调用Power-Shell脚本进行npm安装和其他一些操作。
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:powershell="http://schemas.gardiner.net.au/PowerShellWixExtensionSchema">
<?include Variables.wxi?>
<Product Id="$(var.ProductCode)"
Name="$(var.ProductName)"
Language="1033" Version="1.0.0.1"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="200"
Compressed="yes"
InstallScope="perMachine" />
<Component Id="NpmInstallMain.ps1" Guid="e11556a2-e066-4393-af5c-9c9210187eba" DiskId="1" Directory="INSTALLLOCATION">
<File Id="NpmInstallMain.ps1" Name="NpmInstall.ps1" Source="$(var.SourceFolder)\NpmInstall.ps1"/>
</Component>
<Property Id="POWERSHELLEXE">
<RegistrySearch Id="POWERSHELLEXE"
Type="raw"
Root="HKLM"
Key="SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell"
Name="Path" />
</Property>
<Condition Message="This application requires Windows PowerShell.">
<![CDATA[Installed OR POWERSHELLEXE]]>
</Condition>
<SetProperty Id="RunStartScript"
Before ="RunStartScript"
Sequence="execute"
Value=""C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NonInteractive -ExecutionPolicy Bypass -InputFormat None -NoProfile -File "[INSTALLDIR]/NpmInstall.ps1"" />
<CustomAction Id="RunStartScript" BinaryKey="WixCA" DllEntry="WixQuietExec" Execute="immediate" Return="check" Impersonate="no" />
<InstallExecuteSequence>
<Custom Action="RunStartScript" Before="InstallFinalize">NOT Installed OR UPGRADINGPRODUCTCODE</Custom>
</InstallExecuteSequence>
<UI>
<ProgressText Action="NpmInstallMain">PowerShell Files (elevated)</ProgressText>
</UI>
</Product>
我如何确定问题的原因?我尝试使用控制台记录错误]
msiexec /i CustomInstaller.msi /l*v MyLogFile.txt
但是它没有提供太多有用的信息
Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1708
Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1709
下面的代码为安装MSI提供了机会,无一例外。我希望谁会需要类似的东西会有所帮助。但是,尽管Power Shell脚本可以在控制台中运行,但看起来并没有按预期执行。您对此有任何假设吗?