Resolve Property within Property
Am I correct in believing that if you put a Property as a substring within a Property, it should resolve to the full string? I cannot seem to get it to work.
I have 2 properties:
DomainDNSName = sample.local
ADMINCONSOLEDBLOCATION = \\[DomainDNSName]\dfs\MobilitiDB
and a registry key:
HKCU\Software\test\AdminConsoleDBLocation = [ADMINCONSOLEDBLOCATION]
I want [ADMINCONSOLEDBLOCATION] to resolve to \\sample.local\dfs\MobilitiDB at installation time. Instead of \\sample.local\dfs\MobilitiDB I am getting the literal string \\[DomainDNSName]\dfs\MobilitiDB in the registry value. As part of my troubleshooting, I have simplified it down to ADMINCONSOLEDBLOCATION = [DomainDNSName], but I still get the literal string [DomainDNSName]. I tried changing DomainDNSName to DOMAINDNSNAME, but I still get the literal string.
According to http://msdn2.microsoft.com/en-us/library/aa368609(VS.85).aspx (Formatted data type):
"If a substring of the form [propertyname] is encountered, it is replaced by the value of the property. If propertyname is not a valid property name, then the substring resolves as blank."
and on http://msdn2.microsoft.com/en-us/library/aa370745(VS.85).aspx (Path data type):
"The string may also contain a property name enclosed in square brackets [ ]. In such a case, the name of the property, including the brackets, is replaced in the string by the value of the property.
Examples:
..."
Although the above quotes are not specifically talking about properties within properties, everything else indicates that it should work.
I am using Wise Package Studio 5.6.
I have 2 properties:
DomainDNSName = sample.local
ADMINCONSOLEDBLOCATION = \\[DomainDNSName]\dfs\MobilitiDB
and a registry key:
HKCU\Software\test\AdminConsoleDBLocation = [ADMINCONSOLEDBLOCATION]
I want [ADMINCONSOLEDBLOCATION] to resolve to \\sample.local\dfs\MobilitiDB at installation time. Instead of \\sample.local\dfs\MobilitiDB I am getting the literal string \\[DomainDNSName]\dfs\MobilitiDB in the registry value. As part of my troubleshooting, I have simplified it down to ADMINCONSOLEDBLOCATION = [DomainDNSName], but I still get the literal string [DomainDNSName]. I tried changing DomainDNSName to DOMAINDNSNAME, but I still get the literal string.
According to http://msdn2.microsoft.com/en-us/library/aa368609(VS.85).aspx (Formatted data type):
"If a substring of the form [propertyname] is encountered, it is replaced by the value of the property. If propertyname is not a valid property name, then the substring resolves as blank."
and on http://msdn2.microsoft.com/en-us/library/aa370745(VS.85).aspx (Path data type):
"The string may also contain a property name enclosed in square brackets [ ]. In such a case, the name of the property, including the brackets, is replaced in the string by the value of the property.
Examples:
- UNC path: \\server\share
- Local drive: c:\temp
- With a property name: [DRIVE]\temp
..."
Although the above quotes are not specifically talking about properties within properties, everything else indicates that it should work.
I am using Wise Package Studio 5.6.
0 Comments
[ + ] Show comments
Answers (4)
Please log in to answer
Posted by:
anonymous_9363
16 years ago
I think I'm right in saying that if you only have the properties defined in the Property table, they will NOT be resolved in the way you require. However, there's a simple solution: just whack a Set Property Custom Action in your UI and EI sequences, using the required string '\\[DomainDNSName]\dfs\MobilitiDB' at the 'Property Value'.
Posted by:
Regen
16 years ago
Posted by:
anonymous_9363
16 years ago
Posted by:
Regen
16 years ago
In my case, the property ADMINSONSOLEDBLOCATION is a public property that I wanted to be able to specify at the command line like
msiexec /i ism71.msi TRANSFORMS=ism71.mst ADMINCONSOLEDBLOCATION=\\server\share\etc
I did some testing, and found that if I set the property using a Set Property custom action in Execute Immediate, this overwrote the setting from the command line. To work around this, I wrapped it in an If statement. The If statement checks if the value of the Property has changed from the default, and only dynamically sets it if it has not changed from the default. If it has changed from the default, then it must have been set at the command line, so do not dynamically set it.
I probably could have done the If statement with native MSI Script commands, but I am more familiar with VBScript, to I chose to do the entire thing as an embedded VBScript custom action.
--- start script ---
'allow for public property ADMINCONSOLEDBLOCATION to be changed from command line at install time by using If statement
'to check If the value has changed from the default
If Session.Property("ADMINCONSOLEDBLOCATION") = "\\[DomainDNSName]\dfs\MobilitiDB" Then
Session.Property("ADMINCONSOLEDBLOCATION") = "\\" & Session.Property("DomainDNSName") & "\dfs\MobilitiDB"
End If
msiexec /i ism71.msi TRANSFORMS=ism71.mst ADMINCONSOLEDBLOCATION=\\server\share\etc
I did some testing, and found that if I set the property using a Set Property custom action in Execute Immediate, this overwrote the setting from the command line. To work around this, I wrapped it in an If statement. The If statement checks if the value of the Property has changed from the default, and only dynamically sets it if it has not changed from the default. If it has changed from the default, then it must have been set at the command line, so do not dynamically set it.
I probably could have done the If statement with native MSI Script commands, but I am more familiar with VBScript, to I chose to do the entire thing as an embedded VBScript custom action.
--- start script ---
'allow for public property ADMINCONSOLEDBLOCATION to be changed from command line at install time by using If statement
'to check If the value has changed from the default
If Session.Property("ADMINCONSOLEDBLOCATION") = "\\[DomainDNSName]\dfs\MobilitiDB" Then
Session.Property("ADMINCONSOLEDBLOCATION") = "\\" & Session.Property("DomainDNSName") & "\dfs\MobilitiDB"
End If
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.