尝试在事务模式下打开MSI时,MSI API引发错误 [英] MSI API throws error when attemptin to open MSI in transaction mode

查看:164
本文介绍了尝试在事务模式下打开MSI时,MSI API引发错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这是否是正确的论坛,但是.

我正在编写一个控制台应用程序,等待从构建服务器写入触发文件,构建安装程序,修改一些MSI属性,然后复制文件.然后,应用程序等待下一个触发器,然后再次启动该过程.

我的应用程序第一次运行良好,等待触发器文件并开始运行,但失败并出现以下错误.

System.Runtime.InteropServices.COMException未处理= -2147467259
StackTrace:
在System.RuntimeType.ForwardCallToInvokeMember(字符串memberName,BindingFlags标志,对象目标,Int32 [] aWrapperTypes,MessageData& msgData)在WindowsInstaller.Installer.OpenDatabase(String OpenMode)
,位于C:\ Documents and Settings \ builder \ My Documents \ Visual Studio 2008 \ Projects \ InstallBuilderCmd \ ConsoleApplication1 \ ProcessBuild.cs:Line 38 C:\ D中的Program.OnChanged(对象源,FileSystemEventArgs e) oocments and Settings \ builder \ My Documents \ Visual Studio 2008 \ Projects \ InstallBuilderCmd \ ConsoleApplication1 \ Program.cs:line 43
在System.IO.FileSystemWatcher.OnCreated(FileSystemEventArgs e)
在System.IO.FileSystemWatcher. NotifyFileSystemEventArgs(Int32操作,字符串名称) pOVERLAP)
InnerException:

这是我正在运行的代码:

WindowsInstaller. 查看 view = ;
WindowsInstaller.
安装程序 安装;
WindowsInstaller.
数据库 dbWrite;
inst =(WindowsInstaller.
安装程序 ) 激活器 .CreateInstance( Type .GetTypeFromProgID( " WindowsInstaller.Installer" )));
在哪里发生故障;
dbWrite = inst.OpenDatabase(
" C:\\ Installation \\ Installers \\ EDEN_5.0 \\ Eden.msi' ,WindowsInstaller. MsiOpenDatabaseMode .msiOpenDatabaseModeTransact);

字符串 msiFile = "C:\\ Installation \\ Installers \\ EDEN_5.0 \\ Eden.msi" ;
字符串 iniFile = " C:\\ Installation \\ Installers \ \ EDEN_5.0 \\ Eden.ini"; ;
字符串 edenDeployPoint = \\\\ Myserver \\ Prod Dev \\ Deploy \\ Eden \\ Eden.msi ;
<字体颜色=#0000ff" size = 2>字符串
edenIniDeployPoint = \\\\ Myserver \\ Prod Dev \\ Deploy \\ Eden \\ Eden.ini ;
字符串 qalabDeployPoint = \\\\ 我的服务器 \\ QALABDeploy \\ Eden \\ Eden.msi ;
<字体颜色=#0000ff" size = 2> <字体颜色=#0000ff" size = 2>字符串 qalabIniDeployPoint = <字体颜色=# a31515"size = 2> \\\\ Myserver \\ QALABDeploy \\ Eden \\ Eden.ini ;
字符串 setConfigPathQuery = "更新`Property` SET`Property`.`Val​​ue`='\\\ socrates \\ Prod Dev \\ EDSDBConfig.xml' Property`.`Property` ='MyProperty' ;
字符串 setInstallDirQuery = 更新属性"设置属性".值" ="C:\\ Program Files \\ Tyler \\ Eden",在属性"中.`属性`= <字体颜色=#a31515"大小= 2> MyProperty " ;

view = dbWrite.OpenView(setInstallDirQuery);
view.Execute(
null );
view = dbWrite.OpenView (setConfigPathQuery);
view.Execute(
null );
dbWrite.Commit();
view.Close();

File .Copy(iniFile ,edenIniDeployPoint, true );
File .Copy(msiFile,edenDeployPoint , true );

setConfigPathQuery = "更新`Property` SET`属性`.Value` ='\\\\ qawebext \\ qalabdeploy \\ edsdbconfig.xml'WHERE`Property`.`Property` =' MyProperty ' " ;
setInstallDirQuery =
"更新`Property` SET`Property`.Value` ='C:\\\\ Program Files \\ Tyler \\ Eden'WHERE`Property.`Property` = MyProperty "" ;
view = dbWrite.OpenView(setInstallDirQuery);
view.Execute(
null );
view = dbWrite.OpenView( setConfigPathQuery);
view.Execute(
null );
dbWrite.Commit();
view.Close();
File .Copy(msiFile,qalabDeployPoint, true );
文件 .Copy(iniFile,qalabIniDeployPoint, true );

Im not sure if this is the correct forum but.

I am writing a console app that waits for a trigger file to be written from a build server, builds an installer, Modifies some MSI properties and then copies the files.  The app then waits for the next trigger and starts the process again.

My app runs fine the first time, waits for the trigger file and starts to run but failes with the following error.

System.Runtime.InteropServices.COMException was unhandled
  HelpLink="Msi.chm#9006"
  Message="OpenDatabase,DatabasePath,OpenMode"
  Source="Msi API Error"
  ErrorCode=-2147467259
  StackTrace:
       at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
       at WindowsInstaller.Installer.OpenDatabase(String DatabasePath, Object OpenMode)
       at InstallBuilder.ProcessBuild.BuildInstaller(FileSystemEventArgs e) in C:\Documents and Settings\builder\My Documents\Visual Studio 2008\Projects\InstallBuilderCmd\ConsoleApplication1\ProcessBuild.cs:line 38
       at InstallBuilder.Program.OnChanged(Object source, FileSystemEventArgs e) in C:\Documents and Settings\builder\My Documents\Visual Studio 2008\Projects\InstallBuilderCmd\ConsoleApplication1\Program.cs:line 43
       at System.IO.FileSystemWatcher.OnCreated(FileSystemEventArgs e)
       at System.IO.FileSystemWatcher.NotifyFileSystemEventArgs(Int32 action, String name)
       at System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* overlappedPointer)
       at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
  InnerException:

Here is the code I am running:

WindowsInstaller.View view = null;
WindowsInstaller.
Installer inst;
WindowsInstaller.
Database dbWrite;
inst = (WindowsInstaller.
Installer)Activator.CreateInstance(Type.GetTypeFromProgID("WindowsInstaller.Installer"));
HERE IS WHERE THE FAILURE OCCURES;
dbWrite = inst.OpenDatabase(
"C:\\Installation\\Installers\\EDEN_5.0\\Eden.msi", WindowsInstaller.MsiOpenDatabaseMode.msiOpenDatabaseModeTransact);

string msiFile = "C:\\Installation\\Installers\\EDEN_5.0\\Eden.msi";
string iniFile = "C:\\Installation\\Installers\\EDEN_5.0\\Eden.ini";
string edenDeployPoint = \\\\Myserver\\Prod Dev\\Deploy\\Eden\\Eden.msi;
string edenIniDeployPoint = \\\\Myserver\\Prod Dev\\Deploy\\Eden\\Eden.ini;
string qalabDeployPoint = \\\\Myserver\\QALABDeploy\\Eden\\Eden.msi;
string qalabIniDeployPoint = \\\\Myserver\\QALABDeploy\\Eden\\Eden.ini;
string setConfigPathQuery = "UPDATE `Property` SET `Property`.`Value`='\\\\socrates\\Prod Dev\\EDSDBConfig.xml' WHERE `Property`.`Property` = 'MyProperty";
string setInstallDirQuery = "UPDATE `Property` SET `Property`.`Value`='C:\\Program Files\\Tyler\\Eden' WHERE `Property`.`Property`=MyProperty";

view = dbWrite.OpenView(setInstallDirQuery);
view.Execute(
null);
view = dbWrite.OpenView(setConfigPathQuery);
view.Execute(
null);
dbWrite.Commit();
view.Close();

File.Copy(iniFile, edenIniDeployPoint, true);
File.Copy(msiFile, edenDeployPoint, true);

setConfigPathQuery = "UPDATE `Property` SET `Property`.`Value`='\\\\qawebext\\qalabdeploy\\edsdbconfig.xml' WHERE `Property`.`Property` = 'MyProperty'";
setInstallDirQuery =
"UPDATE `Property` SET `Property`.`Value`='C:\\\\Program Files\\Tyler\\Eden' WHERE `Property`.`Property`=MyProperty";
view = dbWrite.OpenView(setInstallDirQuery);
view.Execute(
null);
view = dbWrite.OpenView(setConfigPathQuery);
view.Execute(
null);
dbWrite.Commit();
view.Close();
File.Copy(msiFile, qalabDeployPoint, true);
File.Copy(iniFile, qalabIniDeployPoint, true);

推荐答案

我遇到了同样的错误.您找到了解决方案吗?

谢谢

Hi I am getting the same error. Have you found a solution for this?

Thanks


这篇关于尝试在事务模式下打开MSI时,MSI API引发错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆