문제

I have a 2006 era application that I need to create an installer for. For the application to work correctly the SQL Server instance and database name need to be added to the arguments of the shortcut.

The issue I am having is that my variable values are not populating the arguments of a shortcut.

From the install log, I can see that the variables values get populated from a custom dialog and i can see the shortcut being created but the arguements are not being added.

<?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>

Any ideas what I am doing wrong?

도움이 되었습니까?

해결책

<?define?> creates a preprocessor variable, which is resolved at build time. You want a property, which is a runtime concept. Use <Property>, make it public by using an Id that's all uppercase, and set the Secure attribute value to yes to propagate from the UI to the install runtime.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top