问题
WIX, MSI-installer.
I build this MSI on some computer where my login name is developer
. In my MSI I have such dialog window:
But third variant always contains developer
user name even if current user has other login name... How can I fix it?
This is my code of these elements:
<Control Id="rbgrPath" Type ="RadioButtonGroup"
X="5" Y="80" Width="500" Height="100" Property="INSTALLFOLDER">
<RadioButtonGroup Property="INSTALLFOLDER">
<RadioButton
Text="[$(var.PLATFORMPROGRAMFILESFOLDER)]Autodesk\ApplicationPlugins\ProxyTools.bundle\"
Value="[$(var.PLATFORMPROGRAMFILESFOLDER)]Autodesk\ApplicationPlugins\ProxyTools.bundle\"
Height="13" Width="500" X="5" Y="5"/>
<RadioButton
Text="$(env.ProgramData)\Autodesk\ApplicationPlugins\ProxyTools.bundle\"
Value="$(env.ProgramData)\Autodesk\ApplicationPlugins\ProxyTools.bundle\"
Height="13" Width="500" X="5" Y="20"/>
<RadioButton
Text="$(env.AppData)\Autodesk\ApplicationPlugins\ProxyTools.bundle\"
Value="$(env.AppData)\Autodesk\ApplicationPlugins\ProxyTools.bundle\"
Height="13" Width="500" X="5" Y="35"/>
</RadioButtonGroup>
</Control>
UPD
This is of the PLATFORMPROGRAMFILESFOLDER
variable definition:
回答1:
This is because $(env.AppData)
and other preprocessor strings are evaluated when you build your package. The second radio button's value will also be incorrect on a machine that happens to use a system drive other than C: (or on older—hopefully unsupported—systems that don't use C:\ProgramData). So you should instead use run-time property substitutions:
$(env.ProgramData)
should be replaced with[CommonAppDataFolder]
$(env.AppData)
should be replaced with either[AppDataFolder]
or[LocalAppDataFolder]
- If
[$(var.PLATFORMPROGRAMFILESFOLDER)]
doesn't resolve to[ProgramFilesFolder]
or[ProgramFiles64Folder]
, it should probably be changed to do so.
Note that it's fine to use additional directory properties to refer to these locations, as long as you are setting their values from the properties referenced above.
来源:https://stackoverflow.com/questions/39995743/how-to-get-current-user-appdata-folder