如何使用C ++中的Windows Installer API创建.msi文件 [英] How can I create .msi file using Windows Installer APIs from C++

查看:127
本文介绍了如何使用C ++中的Windows Installer API创建.msi文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友们,



我需要创建一个.msi文件运行时间。



为此,我需要使用C ++代码中的Windows Installer API。



我正在搜索,但我只能用C#而不是C ++找到样本。 />


C ++创建.msi文件不是个好主意吗?



非常感谢您的帮助。



-Ravi

Hi Friends,

I have a requirement for creating a .msi file run time.

For that, I need to use Windows Installer API from C++ code.

I was searching, but I could find the samples only with C#, not C++.

Is C++ not a good idea to create an .msi file?

Thanks a lot for your help.

-Ravi

推荐答案

你可以 - 我已经完成了 - 但它的记录很少 - 我们的msicreator可能需要几年时间才能达到目前状态



MSI数据库sdk [ ^ ]



有些方向:)



1.了解MSI是什么 - 一堆表(通过sql'ish命令访问)和som e压缩文件流 - 它使用OTHER撇号(`)作为列名

2. summaryStream对于正确非常重要

3.使用orca(在sdk中) )调试/检查MSI(ICE测试是非常宝贵的)

4.不要试图从站立开始建立一个 - 有一个'模板'MSI并添加东西

5.至少你需要了解组件,文件,功能,属性和执行表

6.了解ProductCode的作用 - 你可能想要每个都有一个新的您建立的MSI



策略



1.复制模板MSI(ISTR在MSI SDK中有一个) )

2.将属性设置为属性表(ProductName,ProductVersion,ProductCode,ProductLang等)

3.将功能,组件添加到这些功能和文件中对那些组件,注意使目录表正确(这是用sql完成的)

4.(o ptionally)将您的文件数据插入MSI流 - 您只需指向SxS文件,我使用CAB内容,这要求学习FCI C ++(cab)界面

5.整理出来摘要流

6.大量测试







或者看看 WiX [ ^ ] - 构建一个WiX xml文件并在运行时将其打包出来



如果我不得不再次使用它,我会使用WiX - 它没有我们开始时存在
you CAN - i've done it - but it's poorly documented - our msicreator has probably taken a couple of man-years to get to its current state

MSI Database sdk[^]

Some direction :)

1. understand WHAT an MSI is - a bunch of tables (accessed thru sql'ish commands) and some compressed file streams - it uses the OTHER apostrophe (`) for column names
2. the summaryStream is very important to get right
3. use orca (in the sdk) to debug/examine MSIs with (the ICE tests are invaluable)
4. DO NOT EVEN ATTEMPT to build one from a standing start - have a 'template' MSI and add things to that
5. at the very least you need to understand Component, File, Feature, Property and the Execution tables
6. understand what the ProductCode does - you probably want a new one for each MSI you build

strategy

1. Copy your template MSI (ISTR there's one in the MSI SDK)
2. Set your properties into the Property Tables (ProductName, ProductVersion, ProductCode, ProductLang etc)
3. Add your features, your components to those features, and files to those components, taking care to get the directory table right (this is all done with sql)
4. (optionally) insert your file data into the MSI streams - you CAN simply point to SxS files, I use CAB'd content, which mandates learning the the FCI C++ (cab) interface
5. Sort out the summary stream
6. lots of testing



or look at WiX[^] - build a WiX xml file and shell out to that at runtime

if i had to do it again, i'd use WiX - it didn't exist when we started


非常感谢Barneyman的回答。这非常有用。
Thank you very much Barneyman for your answer. It is very helpful.


这篇关于如何使用C ++中的Windows Installer API创建.msi文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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