Visual Studio Setup and Deployment Project, Unattended installation and Custom Properties

When execute an installer made with Visual Studio in the following way:

msiexec /i ProgramInstaller.msi /q TARGETDIR=C:\Program CUSTOMPROPERTY1=”SomeValue”

The custom property CUSTOMPROPERTY1 didnt’t take the value “SomeValue”. After look at the log of the installation (generated with msiexe /log) I saw that Visual Studio always generates a custom action for each property to assign the default value. These custom actions (that have the name CustomTextA_SetProperty_EDITx) are excecute after Windows Installer assigns the properties with the values of the parameters. The solution was eliminated those custom actions, first using Orca and then with this script:

Option Explicit

Dim WI, DB, DelCustom, DelCustom2
Dim Path_MSI_File
Const msiOpenDatabaseModeDirect = 2

Set WI = CreateObject(“WindowsInstaller.Installer”): CheckError
Path_MSI_File = ” “

Path_MSI_File = Wscript.Arguments(0)
Set DB = WI.OpenDatabase(Path_MSI_File,msiOpenDatabaseModeDirect):CheckError

‘Remove VS Custom Actions
Set DelCustom = DB.OpenView(“Delete From CustomAction WHERE `Action`=’CustomTextA_SetProperty_EDIT1′”):CheckError
DelCustom.Execute : CheckError

Set DelCustom2 = DB.OpenView(“Delete From InstallUISequence WHERE `Action`=’CustomTextA_SetProperty_EDIT1′”):CheckError
DelCustom2.Execute : CheckError

‘Finish
Set WI = Nothing
Wscript.Quit 0

Sub CheckError
Dim message, errRec
If Err = 0 Then Exit Sub
message = Err.Source & ” “ & Hex(Err) & “: “ & Err.Description
If Not installer Is Nothing Then
Set errRec = installer.LastErrorRecord
If Not errRec Is Nothing Then message = message & vbLf & errRec.FormatText
End If
Fail message
End Sub

Sub Fail(message)
Wscript.Echo message
Wscript.Quit 2
End Sub

About Rodolfo Finochietti

Uma's and Gino's father, and a programmer ;)

Posted on 02/11/2006, in Visual Studio. Bookmark the permalink. 1 Comment.

  1. Wow, fantastic blog structure! How long have you ever been blogging for?
    you make running a blog glance easy. The whole look of your site is excellent, as well as the content!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: