InstallShield是构建Windows安装程序和MSIX包并直接在Microsoft Visual Studio中创建安装的最快速最简单的方法。借助InstallShield,您可以快速适应行业的变化,更快地进入市场并提供引人入胜的客户体验。
InstallShield最新试用版
ISWiProductConfig和ISWiRelease对象
在InstallShield环境中使用时,可以使用发行向导来创建产品配置和发行名称,并可以将发行属性设置为媒体类型,是否包括Windows Installer可再发行文件以及是否压缩数据文件。您可以在版本视图中查看现有版本,并通过在版本视图中右键单击其图标并选择生成来重建版本,或按F7键来重建当前版本。
在项目文件中,每个产品配置均由ISWiProductConfig Automation对象表示,每个发行版均由ISWiRelease对象表示。此外,还有称为ISWiProductConfigs和ISWiReleases的集合,用于存储项目中的所有产品配置和发行版。
例如,您可以将以下代码放置在名为EnumReleases.vbs的VBScript文件中,并执行该文件以查看显示给定项目中所有产品配置和发行版的消息框。(使用自动化界面打开项目时,请注意,不应在InstallShield环境中打开该项目。)
' NOTE: ProgID changes with each InstallShield version;' check documentation to see your version's ProgIDSet oISM = CreateObject("ISWiAuto14.ISWiProject")' open project as read-onlyoISM.OpenProject "D:MySetupsBuildMe.ism", TruestrAllReleases = ""' walk through all product configurationsFor Each oConfig in oISM.ISWiProductConfigsstrAllReleases = strAllReleases + vbNewLine + oConfig.Name + vbNewLine' walk through all releases in current product configurationFor Each oRelease in oConfig.ISWiReleases strAllReleases = strAllReleases + vbTab + _ oRelease.Name + vbNewLineNext ' oRelease Next ' oConfigMsgBox strAllReleases, , "Product Configs and Releases"oISM.CloseProject
清单1:EnumReleases.vbs
运行EnumReleases.vbs时,应该看到类似于以下内容的消息框,其中显示了所有产品配置,并在每个产品配置名称下缩进了每个发行版名称。

Set oISM = CreateObject("ISWiAuto14.ISWiProject")' open project as read-onlyoISM.OpenProject "D:MySetupsBuildMe.ism", True' build the releaseoISM.ISWiProductConfigs("Version1").ISWiReleases("cdrom").Build( )' for testing purposesMsgBox "Done!"oISM.CloseProject
清单2:BuildRelease.vbs
结合前面的两个示例,您可以构建项目中包含的每个发行版。
Set oISM = CreateObject("ISWiAuto14.ISWiProject")' open project as read-onlyoISM.OpenProject "D:MySetupsBuildMe.ism", True' walk through all product configurationsFor Each oConfig in oISM.ISWiProductConfigs' walk through all releases in current product configurationFor Each oRelease in oConfig.ISWiReleases oRelease.Build( ) ' for testing purposesMsgBox "Built " & oConfig.Name & "/" & oRelease.Name & "..."Next ' oReleaseNext ' oConfig' for testingMsgBox "Done!"oISM.CloseProject
创建发布
您还可以使用自动化界面,通过AddProductConfig和AddRelease方法将产品配置和发行版添加到项目中。添加产品配置或发行版后,您可以使用创建的ISWiProductConfig或ISWiRelease对象的各个自动化属性来指定其属性(通常在发行向导中输入的属性)。
例如,假设您要在一个名为DemoVersion1的现有产品配置中创建一个名为new的发行版。您可以在代码中使用AddRelease方法,如下所示。请注意,如果项目中已经存在您指定的发行版,则脚本将失败。
Set oISM = CreateObject("ISWiAuto14.ISWiProject")' this time, open project as read-writeoISM.OpenProject "D:MySetupsBuildMe.ism", False' get existing configurationSet oMyConfig = oISM.ISWiProductConfigs("DemoVersion1")' add new release to existing configurationSet oNewRelease = oMyConfig.AddRelease("new")' set release propertiesoNewRelease.Compressed = TrueoNewRelease.SetupEXE = TrueoNewRelease.TargetOS = 3 ' i.e., os9xNT: include both engines' ...set other properties...' if you want, build the new releaseoNewRelease.Build( )' for testingMsgBox "Done!"' this time, save the project before closing itoISM.SaveProjectoISM.CloseProject
推荐文章:
MSI功能和组件的使用
从自定义操作写入日志文件PDF文档
如果您想要购买正版授权InstallShield,可以联系在线客服>>咨询相关问题。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!