MSI - 将两个转换合并为一个mst文件。 [英] MSI - Merge two transforms into a single mst file.

查看:145
本文介绍了MSI - 将两个转换合并为一个mst文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


说,我有一个msi文件"xyz.msi"和两个变换文件"T1.mst"和"T2.mst"。


我需要合并mst内容并创建一个mst文件"T.mst",而不是拥有两个mst文件。


我尝试使用以下代码:


  using(Database srcdb = new Database(" xyz.msi")))
            {

                using(Database trgdb = new Database(" tempMsi.msi",DatabaseOpenMode.Transact))

                {

                   锁(trgdb)

                    {

                        trgdb.ApplyTransform(T1.mst);

                        trgdb.ApplyTransform(T2.mst);

                        trgdb.Commit();

                       

                    }¥b $ b                    trgdb.Close();

                }¥b $ b                srcdb.Close();

            }


但是由于重复的条目,它在应用第二次转换时会抛出错误。我尝试使用以下行来避免错误。


trgdb.ApplyTransform(mst2, TransformErrors。 AddExistingRow );


但这有一个问题。假设转换文件T1.mst有一个表格,其条目为"PropertyName:0101"。和T2.mst具有相同的表格,其中包含条目 "PropertyName:0102"。但由于无法添加重复属性,因此跳过第二个转换
中的条目!但是我需要一种方法来合并它,最后的转换有条目 "PropertyName:0101,0102"


这是否适合?如果是这样的话?


Regrads,


Pradeep R

解决方案

使用 Windows \v7.1 \Samples \sysmgmt \ msi \scripts \wisubstg.vbs


http:// msdn .microsoft.com / zh-CN / library / aa369793(v = vs.85).aspx


< a href ="http://msdn.microsoft.com/en-us/library/aa367576(v=vs.85).aspx"> http://msdn.microsoft.com/en-us/library/aa367576( v = vs.85)的.aspx


Hi,

Say, I have a msi file "xyz.msi" and two transform files "T1.mst" and "T2.mst".

Instead of having two mst files, I need to merge the mst contents and create a single mst file "T.mst".

I tried using the below code:

 using (Database srcdb = new Database("xyz.msi"))
            {
                using (Database trgdb = new Database("tempMsi.msi", DatabaseOpenMode.Transact))
                {
                    lock (trgdb)
                    {
                        trgdb.ApplyTransform(T1.mst);
                        trgdb.ApplyTransform(T2.mst);
                        trgdb.Commit();
                       
                    }
                    trgdb.Close();
                }
                srcdb.Close();
            }

But it throws error when applying the second transform due to duplicate entries. I tried using  the below line to avoid the error.

trgdb.ApplyTransform(mst2,TransformErrors.AddExistingRow);

But there is an issue in this. Say the Transform file T1.mst has a table with entry "PropertyName: 0101" and T2.mst has the same table with entry "PropertyName: 0102". But since duplicate properties cannot be added, the entry in the second transform is skipped!! But I need a way in which this gets merged and the final transform has the entry "PropertyName: 0101, 0102"

Is this achivable? If so how?

Regrads,

Pradeep R

解决方案

Merging all the MST files into a single installer using the Windows\v7.1\Samples\sysmgmt\msi\scripts\wisubstg.vbs

http://msdn.microsoft.com/en-us/library/aa369793(v=vs.85).aspx

http://msdn.microsoft.com/en-us/library/aa367576(v=vs.85).aspx


这篇关于MSI - 将两个转换合并为一个mst文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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