Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am creating an installer using Visual Studio 2010. All feature works fine with the installer. But I want to do some additional things on this. As users can change the installation directory, I am installing the app in [SELECTEDDIR]\MYAPP folder. But the problem is when user selects the location for example F:\ then the location box of the GUI only shows F:\ but I want to show "F:\MYAPP". How to accomplish this?

EDITED:
I have done the following in BrowseDlg in my code. but it is not working it still doesn't shows the appended folder name in the location text.

XML
<!--<Browse Dlg>-->
      <Dialog Id="BrowseDlg1" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
        
        <Control Id="PathEdit" Type="PathEdit" X="84" Y="202" Width="261" Height="18"
          Property="_BrowseProperty" Indirect="yes" />

        <Control Id="OK" Type="PushButton" X="304" Y="243" Width="56" Height="17"
   Default="yes" Text="[ButtonText_OK]">
          <Publish Event="SetTargetPath" Value="[_BrowseProperty][FolderCust]">1</Publish>
          <Publish Event="EndDialog" Value="Return">1</Publish>
        </Control>

        <Control Id="Cancel" Type="PushButton" X="240" Y="243" Width="56" Height="17"
          Cancel="yes" Text="[ButtonText_Cancel]">
          <Publish Event="Reset" Value="0">1</Publish>
          <Publish Event="EndDialog" Value="Return">1</Publish>
        </Control>

        <Control Id="ComboLabel" Type="Text" X="25" Y="58" Width="44" Height="10"
    TabSkip="no" Text="Look in:" />

        <Control Id="DirectoryCombo" Type="DirectoryCombo" X="70" Y="55" Width="220" Height="80"
          Property="_BrowseProperty" Indirect="yes" Fixed="yes" Remote="yes">
          <Subscribe Event="IgnoreChange" Attribute="IgnoreChange" />
        </Control>

        <Control Id="Up" Type="PushButton" X="298" Y="55" Width="19" Height="19"
    ToolTip="Up One Level" Icon="no" FixedSize="yes" IconSize="16" Text="Up">
          <Publish Event="DirectoryListUp" Value="0">1</Publish>
        </Control>

        <Control Id="NewFolder" Type="PushButton" X="325" Y="55" Width="19" Height="19"
          ToolTip="Create A New Folder" Icon="no" FixedSize="yes" IconSize="16" Text="New">
          <Publish Event="DirectoryListNew" Value="0">1</Publish>
        </Control>

        <Control Id="DirectoryList" Type="DirectoryList" X="25" Y="83" Width="320" Height="110"
    Property="_BrowseProperty" Sunken="yes" Indirect="yes" TabSkip="no" />

        <Control Id="Back" Type="PushButton" X="180" Y="243" Width="56" Height="17"
  Text="[ButtonText_Back]">
          <Publish Event="NewDialog" Value="CustomizeDlg1">1</Publish>
        </Control>

      </Dialog>


EDITED2: Directory hierarchy code is shown below
XML
<Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="CompanyFolder" Name="My Company">
          <Directory Id="KONASECUREPASSFOLDER" Name="KonaSecurePass">
            <Directory Id="INSTALLLOCATION" Name="isWixProject">
              <!--<Merge Id="isWixProjectMM" SourceFile="$(var.isWixProjectMM.TargetPath)" DiskId="1" Language="1033"/>-->
            </Directory>
          </Directory>
        </Directory>
      </Directory>
    </Directory>
Posted
Updated 20-Apr-15 19:00pm
v3
Comments
Sergey Alexandrovich Kryukov 16-Apr-15 2:06am    
You are talking something outrageous. What you are using for installation toolkit? Isn't it Setup project type bundled with Visual Studio?
—SA
Naseef-Ur-Rahman Chy 16-Apr-15 2:51am    
Yes the setup project is bundled with Visual Studio.

1 solution

Naseef-Ur-Rahman wrote:

Yes the setup project is bundled with Visual Studio.
Do yourself a big favor and listen to my good friendly advice: throw out this trash. This project type is discontinued to Microsoft, by some very good reasons, and is not even legitimate to Visual Studio.

These day, the really legitimate product is open-source (first Microsoft's open-source product) WiX (presently provided by Microsoft-sponsored Outercurve Foundation, by Microsoft Reciprocal License):
http://en.wikipedia.org/wiki/WiX,
http://wixtoolset.org/,
http://wix.codeplex.com/.

This is the only product I know correctly integrated with MSBuild and fully compliant with MSBuild project standard. The problem you mentioned would sound ridiculous. I know because I using it myself.

[EDIT]

This is a very basic document on the user-entered target directory: http://wixtoolset.org/documentation/manual/v3/wixui/dialog_reference/wixui_installdir.html.

I suggest you read WiX documentation and just search information on your concern on the Web, before you ask further questions yourself. Community of developers actively shares a lot of solutions, but your problem is very standard.

—SA
 
Share this answer
 
v3
Comments
Naseef-Ur-Rahman Chy 16-Apr-15 12:01pm    
I have already tried WIX. But couldn't find the way. I believe you do understand my purpose. Do you know how can I accomplish my purpose using WIX? Thanks in advance
Sergey Alexandrovich Kryukov 16-Apr-15 12:18pm    
I perfectly understand your purpose and think its more than reasonable. Well, with WiX, these are default feature you don't even have to customize. The input language is declarative, based on XML, which is orders by magnitude more maintainable; everything is explicitly written in text, Intellisense is supported, declarations are parametrized and thus reusable, and so on. You can declare prerequisite, install dependencies, and so on. This is one of the predefined steps in WiX, as well as many other common steps (file system, registry, firewall settings, change or permission and a lot more).

Now, the installation I use shows the dialog with default target directory with standard way of writing a custom directory (entered by the user, optionally). This is a standard behavior.

I suggest you follow my advice and also accept this answer formally.
In all cases, your follow-up questions will be welcome.

—SA
Naseef-Ur-Rahman Chy 17-Apr-15 0:01am    
Can you please share some codes or project that does what I meant to do? i.e Appending the application folder name in the target directory everytime whenever user changes directory location and show it in GUI.
Sergey Alexandrovich Kryukov 17-Apr-15 1:03am    
I don't understand why appending, what to append to what. This is not standard (and not sure if it reasonable behavior). Usually you are given "Program Files/ProductName" or "Program Files (x86)/ProductName" directory and can change it to anything at all. It's totally up to the user to provide any directory. But — Windows Installer weirdness — net anything at all. You cannot freely choose between "Program Files (x86)" and "Program Files", which does not really makes a lot of sense.
—SA
Naseef-Ur-Rahman Chy 17-Apr-15 1:20am    
Suppose user changed the installation path and opted to selected another drive. Then I want to create a folder and install the product on the folder. And I want to show the installation location along with the created folder in the GUI where location is displayed.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900