将参数添加到基于快捷方式的值,这些值来自无效的变量

时间:2012-01-12 01:25:55

标签: attributes wix shortcut wix3.6

我有一个2006年代的应用程序,我需要为其创建一个安装程序。为使应用程序正常工作,需要将SQL Server实例和数据库名称添加到快捷方式的参数中。

我遇到的问题是我的变量值没有填充快捷方式的参数。

从安装日志中,我可以看到变量值从自定义对话框中填充,我可以看到正在创建的快捷方式但是没有添加争论。

<?define SqlServerInstance="SqlServerInstance" ?>
<?define DatabaseName="DatabaseName" ?>

<Component Id="LWS" Guid="0FB32FAD-83B2-4C0B-B929-C93220E4681A">
    <File Id='LwsEXE' Name='Lws.exe' DiskId='1' Source='..\files\lws\Lws.exe' KeyPath='yes'>
        <Shortcut Id="startmenuLWS" Directory="ProgramMenuFolder" Name="LWS" WorkingDirectory='INSTALLDIR' Icon="LWS.ico" IconIndex="0" Advertise="yes" Arguments="[SqlServerInstance] [DatabaseName]"  />
        <Shortcut Id="desktopLWS" Directory="DesktopFolder" Name="LWS" WorkingDirectory='INSTALLDIR' Icon="LWS.ico" IconIndex="0" Advertise="yes" Arguments="[SqlServerInstance] [DatabaseName]"  />
    </File>
</Component>

<Dialog Id="DatabaseLocationDlg" Width="370" Height="270" Title="[ProductName] Database Connection [Setup]" NoMinimize="yes">
    <Control Id="ServerNameLabel" Type="Text" X="45" Y="73" Width="100" Height="15" TabSkip="no" Text="&amp;SQL Server Name:" />
    <Control Id="ServerNameEdit" Type="Edit" X="45" Y="85" Width="220" Height="18" Property="$(var.SqlServerInstance)" Text="[SqlServerInstance]" />
    <Control Id="DataBaseLabel" Type="Text" X="45" Y="110" Width="100" Height="15" TabSkip="no" Text="&amp;Database Name:" />
    <Control Id="DatabaseEdit" Type="Edit" X="45" Y="122" Width="220" Height="18" Property="$(var.DatabaseName)" Text="[DatabaseName]" />
    <!-- more stuff here-->
</Dialog>

任何想法我做错了什么?

1 个答案:

答案 0 :(得分:2)

<?define?>创建一个预处理器变量,该变量在构建时解析。您需要一个属性,这是一个运行时概念。使用<Property>,使用全部为大写的Id将其公开,并将Secure属性值设置为yes,以便从UI传播到安装运行时。