我们开发的产品由客户分销给客户。我们需要允许客户公司的管理员在将安装程序发送给最终用户之前对安装程序进行配置更改。在这种情况下,配置更改意味着要在最终用户计算机上创建几个注册表项。我该怎么做?
答案 0 :(得分:2)
请检查一下: http://ozgrant.com/2008/03/11/customising-your-wix-msi-with-transform-files/
在这里,
HTH
答案 1 :(得分:2)
这是我们发送给客户的示例脚本。他们创建一个自定义配置文件,运行此脚本,最后得到一个MST和一个CAB,它将覆盖基本MSI中包含的默认值。
最初我们只是向客户提供了使用Orca的说明,但这实际上只能让他们更新属性/值 - 如果您需要更换配置文件,那么对于大多数IT员工来说它会变得有点复杂,除非他们有权访问WISE,InstallShield或类似的。
Option Explicit
Const MSI_SRC = "myapp.msi"
Const MSI_TEMP = "temp.msi"
Const MST_FILE = "custom.mst"
Const MY_CONFIG = "customsettings.reg"
Const CAB_FILE = "config.cab"
Dim filesys
Set filesys=CreateObject("Scripting.FileSystemObject")
If filesys.FileExists(MSI_SRC) Then
filesys.CopyFile MSI_SRC, MSI_TEMP
Else
MsgBox "Unable to find " & MSI_SRC & "exiting", 48, "Fatal Error"
Set filesys = Nothing
WScript.Quit
End If
If filesys.FileExists(MST_FILE) Then
filesys.DeleteFile(MST_FILE)
End If
Dim installer, database, database2, view
Set installer = CreateObject("WindowsInstaller.Installer")
Set database = installer.OpenDatabase (MSI_TEMP, 1)
Set database2 = installer.OpenDatabase (MSI_SRC, 1)
If filesys.FileExists(MY_CONFIG) Then
Dim objFile, size, result, seq, objCab
Set objCab = CreateObject("MakeCab.MakeCab.1")
objCab.CreateCab CAB_FILE, False, False, False
objCab.AddFile MY_CONFIG, filesys.GetFileName(MY_CONFIG)
objCab.CloseCab
Set objFile = filesys.GetFile(MY_CONFIG)
size = objFile.Size
Set view = database.OpenView ("SELECT LastSequence FROM Media WHERE DiskId = 1")
view.Execute
Set result = view.Fetch
seq = result.StringData(1) + 1 ' Sequence for new configuration file
Set view = database.OpenView ("INSERT INTO Media (DiskId, LastSequence, Cabinet) VALUES ('2', '" & seq & "', '" & CAB_FILE & "')")
view.Execute
Set view = database.OpenView ("UPDATE File SET FileSize = " & size & ", Sequence = " & seq & ", FileName = 'CUSTOM~2.REG|customsettings.reg' WHERE File = '" & LCase(MY_CONFIG) & "'")
view.Execute
End If
database.GenerateTransform database2, MST_FILE
database.CreateTransformSummaryInfo database2, MST_FILE, 0, 0
' Cleanup
Set database = Nothing
Set database2 = Nothing
Set installer = Nothing
Set view = Nothing
filesys.DeleteFile(MSI_TEMP)
Set filesys = Nothing