开发者

Need a way to add one property to the msi properties table in setup project in VS2010

I've been using Orca to manually add property "REINSTALLMODE" value "amus" into the msi property table every time I build it.

I'm sick of this. I looked into Wix but so far I don't think its worth the hassle to learn it/switch to it just yet, even though it will solve this problem. Is there a way I can automatically insert this one property into the msi after the build is complete? Preferably, it will use only vanilla visua开发者_如何转开发l studio 2010 and not depend on third party programs or system environment variables.

Any thoughts?

Thanks,

Isaac


use a vbscript

change an existing property

set o_installer = CreateObject("WindowsInstaller.Installer")
set o_database = o_Installer.OpenDatabase("path_to_your_msi", 1)
s_SQL = "SELECT Property, Value FROM Property Where Property = 'ReinstallMode'"
Set o_MSIView = o_DataBase.OpenView(s_SQL)
o_MSIView.Execute
Set o_MSIRecord = o_MSIView.Fetch
o_MSIRecord.StringData(2) = "amus"
o_MSIView.Modify 2, o_MSIRecord
o_DataBase.Commit

add an new property

set o_installer = CreateObject("WindowsInstaller.Installer")
set o_database = o_Installer.OpenDatabase("path_to_your_msi", 1)
s_SQL = "INSERT INTO Property (Property, Value) Values( 'ReinstallMode', 'amus')"
Set o_MSIView = o_DataBase.OpenView( s_SQL)
o_MSIView.Execute
o_DataBase.Commit


Another option is to include the version number in the application's install folder.
Set Application folder's default location to something like:
[ProgramFilesFolder]\[ProductName]\[ProductVersion]
Also set the Setup project's 'RemovePreviousVersions' property to true.
This should delete the old version's folder and create a fresh folder for the new version.
Remember to change the Setup project's version property every time you do a new release.


My honest thoughts? You are starting down the road of "VDPROJ is fine except I also need it to do [x]." You'll find a way to hack it and then you'll repeat. Before you know it you'll have a frankenstein solution that is doing all kinds of wierd things to your MSI because the tool doesn't expose it or worse implements it wrong. I really suggest going to InstallShield 2010LE/Pro or WiX.

However, if all you want to do is change REINSTALLMODE from omus to amus, I reccomend using Orca to create a transform one time and then in a post build step apply the transform to your built MSI.

cscript WiUseXfm.vbs [path to original database][path to transform file][options]

Apply a Transform

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜