Solved

Wix Installation Help Needed

Posted on 2014-10-10
12
259 Views
Last Modified: 2014-10-19
Hello, I am building a Wix installation package.  Now I know Wix gives you the ability to have a shortcut in the start menu folder, but I need something a little different.  I have 14 lnk files that I want placed into a folder which is located in the start menu but I am unable to find any information for the startmenu to be an install directory.  So how do I go about doing this?  As an fyi, I need the following setup to be installed.

Start Menu/Appication Name/lnk files

And for the install directory, I need Program Files/Company Name/Application Name/Icon/companyicon.ico
0
Comment
Question by:VBBRett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 6
12 Comments
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 40374937
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
	<Product Id="*" Name="SetupProject1" Language="1033" Version="1.0.0.0" Manufacturer="PolyScience" UpgradeCode="540e433f-85fe-4afa-866f-d557d9409ddd">
		<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

		<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
		<MediaTemplate />

		<Feature Id="ProductFeature" Title="SetupProject1" Level="1">
			<ComponentGroupRef Id="ProductComponents" />
		</Feature>
	</Product>

	<Fragment>
		<Directory Id="TARGETDIR" Name="SourceDir">
			<Directory Id="StartMenuFolder">
				<Directory Id="INSTALLDIR" Name="SetupProject1" />
			</Directory>
		</Directory>
	</Fragment>

	<Fragment>
		<ComponentGroup Id="ProductComponents" Directory="INSTALLDIR">
			<Component Id="ProductComponent">
                                    <File Source="readme.lnk" Name="readme.lnk"></File>
			</Component> 
		</ComponentGroup>
	</Fragment>
</Wix>

Open in new window

0
 

Author Comment

by:VBBRett
ID: 40375723
Thank you.  So where would the ico file go?  Please keep in mind that 1 folder is not a sub folder of the other once installed.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 40375962
I don't quite understand what the problem is, especially "And for the install directory, I need Program Files/Company Name/Application Name/Icon/companyicon.ico". In the code I posted install directory is the folder under start menu, which is somewhat nonstandard, but OK if the installation has nothing else.
If you want .ico file installed in a folder under program files, then it makes sense to make that folder program directory (INSTALLDIR), although usually resource files like .ico are better to put under %appdata%, while program files are mostly for the real executables. But it's all not very critical, and in fact it's not necessary to have any "program directory" at all in the installation; every component may have its own directory.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:VBBRett
ID: 40376149
There is no problem...I don't have much experience with WIX, so coordinating two install directories of resources is a bit of a challenge for me and I want to make sure it works, that's all.  I'll try your solution and report back.
0
 

Author Comment

by:VBBRett
ID: 40376329
Would you be able to explain how I do that with my xml if I were to post my code?
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 40376347
Sure.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 40376350
By the way, installing shortcuts as files is quite exotic. More straightforward would be to install them as actual shortcuts.
0
 

Author Comment

by:VBBRett
ID: 40376375
OK, here is the code.  I may have pushed too far into the wrong direction, but what I was trying to do was add the lnk files and the ico into the program files directory and I wanted to add all of the lnk files into the start menu folder but I did not know how to.  The shortcut I found out can only accept one exe file.  So below is my code:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">  
    <Product Id="*" UpgradeCode="{6AAB7BEE-AFE3-48A4-96F1-25E5EDCC642B}" Version="2.0.0.0" Language="1033" Name="Corp Services" Manufacturer="My Company">            
        <Package InstallerVersion="300" Compressed="yes"/>
      
        <Media Id="1" Cabinet="myapplication.cab" EmbedCab="yes" />      
      
        <!-- Step 1: Define the directory structure -->
        
        <Directory Id="TARGETDIR" Name="SourceDir">
          
            <Directory Id="ApplicationProgramsFolder">
              <Directory Id="COMPANYROOTDIRECTORY" Name="My Company">
                <Directory Id="APPLICATIONROOTDIRECTORY" Name="Corp Services"/>
                <Directory Id="ICONFOLDER" Name="Icons"/>
               </Directory>
            </Directory>  
            <!--<Directory Id="StartMenuFolder">-->
            <Directory Id="ProgramMenuFolder">
              <Directory Id="ApplicationProgamsFolder" Name="Corp Services"/>                              
            </Directory>            
        </Directory>                
        <Binary Id="UninstallAction" SourceFile="..\SetupProject1\bin\Debug\UninstalllegacyCorpServices.exe"></Binary>
        <CustomAction Id="UninstallLegacyCorpServicesAction" BinaryKey="UninstallAction" ExeCommand="run" Execute="immediate" Return="check" Impersonate="no">          
        </CustomAction>


            
      
     
        
        
        
        <!-- Step 2: Add files to your installer package -->
        <DirectoryRef Id="ICONFOLDER">
          <Component Id="MyIcon" Guid="{A8A872E3-E9D0-4E25-BD65-3EA2DC0D4445}">
            <File Id="MyconFile" Source="..\SetupProject1\bin\Debug\My-Icon.ico" KeyPath="yes" Checksum="yes"></File>
          </Component>
        </DirectoryRef>
        
        <DirectoryRef Id="APPLICATIONROOTDIRECTORY">          
            <Component Id="Accounting" Guid="{51130003-F19C-4E49-941B-5ED63DED46D1}">
                <File Id="AccountingFile" Source="..\SetupProject1\bin\Debug\Accounting (Time and Expense).lnk" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="CompanyNews" Guid="{91488CEC-11B3-4424-8F86-C25B99929AD7}">
                <File Id="CompanyNewsFile" Source="..\SetupProject1\bin\Debug\Company News.lnk" KeyPath="yes" Checksum="yes"/>                
            </Component>
            <Component Id="CRM" Guid="{770E9C17-8796-494A-ACB1-B1C5C52DEE8A}">
                <File Id="CRMFile" Source="..\SetupProject1\bin\Debug\CRM.lnk" KeyPath="yes"/>            
            </Component>
            <Component Id="Email" Guid="{66157932-5361-40C8-90E6-E59F03F42BC0}">
                <File Id="EmailFile" Source="..\SetupProject1\bin\Debug\Email Web Access.lnk" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="EnterpriseLaunchPad" Guid="{8749EF3B-3CBD-4D91-B60A-EF50AB29CD4F}">
                <File Id="EnterpriseLaunchPadFile" Source="..\SetupProject1\bin\Debug\Enterprise LaunchPad.lnk" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="HRInformationSystem" Guid="{10446168-F4AC-42AC-9E4A-F18E79624F65}">
                <File Id="HRInformationSystemFile" Source="..\SetupProject1\bin\Debug\HR Information System.lnk" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="HRLearningPortal" Guid="{459BCAA7-F00E-492C-8A2D-57026A0CD897}">
                <File Id="HRLearningPortalFile" Source="..\SetupProject1\bin\Debug\HR Learning Portal.lnk" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="Intranet" Guid="{B40C5FCE-934D-456B-8411-15382B77BB7E}">
                <File Id="IntranetFile" Source="..\SetupProject1\bin\Debug\Intranet.lnk" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="PayslipsIntl" Guid="{AFE98B25-D78B-4BAA-AA1D-A2C584A164D2}">
                <File Id="PayslipsFile" Source="..\SetupProject1\bin\Debug\Payslips - Intl.lnk" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="PayslipsUS" Guid="{F8045D6C-648A-436B-A708-7E9D87582AF4}">
                <File Id="PayslipsFileUS" Source="..\SetupProject1\bin\Debug\Payslips - US.lnk" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="ProjectControlSystems" Guid="{066613B7-2C28-474B-8F60-2E3696486E77}">
                <File Id="ProjectControlSystemsFile" Source="..\SetupProject1\bin\Debug\Project Control Systems.lnk" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="RemoteAccess" Guid="{F7F9B3C5-C294-46D0-BD2D-942043341EAB}">
                <File Id="RemoteAccessFile" Source="..\SetupProject1\bin\Debug\Remote Access(VPN).lnk" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="SignIn" Guid="{B6DC77C7-198D-4149-8346-2494D61C1C70}">
                <File Id="SigninFile" Source="..\SetupProject1\bin\Debug\Sign-in to Corp Services.lnk" KeyPath="yes" Checksum="yes"/>
            </Component>
            <Component Id="WebFileTransfer" Guid="{2585CA27-1CA7-4629-ADDA-6744426561F8}">
                <File Id="WebFileTransferFile" Source="..\SetupProject1\bin\Debug\Web File Transfer.lnk" KeyPath="yes" Checksum="yes"/>
            </Component>                              
        </DirectoryRef>
      
            
     <!-- <DirectoryRef Id="StartMenuFolder">-->
      <DirectoryRef Id="ApplicationProgramsFolder">      
          <Component Id="ApplicationShortcut" Guid="{CD186813-D08F-4A80-A4D5-F91254E28D46}">           
            <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
            <RemoveFolder Id="ApplicationShortcut" On="uninstall"/>
            <RegistryValue Root="HKCU" Key="Software\My Company\Corp Services" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
          </Component>          
        </DirectoryRef>

        <!-- Step 3: Tell WiX to install the files -->
        <Feature Id="MainApplication" Title="Main Application" Level="1">            
            <ComponentRef Id="Accounting" />
            <ComponentRef Id="CompanyNews" />
            <ComponentRef Id="CRM" />
            <ComponentRef Id="Email" />
            <ComponentRef Id="EnterpriseLaunchPad" />
            <ComponentRef Id="HRInformationSystem" />
            <ComponentRef Id="HRLearningPortal" />
            <ComponentRef Id="Intranet" />
            <ComponentRef Id="PayslipsIntl" />
            <ComponentRef Id="PayslipsUS" />
            <ComponentRef Id="ProjectControlSystems" />
            <ComponentRef Id="RemoteAccess" />
            <ComponentRef Id="SignIn" />
            <ComponentRef Id="WebFileTransfer"/>
            <ComponentRef Id="MyIcon"/>
          <ComponentRef Id="ApplicationShortcut"/>
        </Feature>
        <InstallExecuteSequence>
          <Custom Action="UninstallLegacyCorpServicesAction" Before="InstallFiles"></Custom>          
        </InstallExecuteSequence>
    </Product>        
    
</Wix>

Open in new window

0
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 500 total points
ID: 40377059
Here's the code that will install one shortcut under start menu, and will install icon file under program files. You should be able to configure other shortcuts in similar manner. We also included one regular shortcut "my notepad", as an alternative to using .lnk files.

If your shortcuts are to the network locations on your corporate network, we would recommend to install them in "nethood" folder , rather than in start menu.


<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
  <Product Id="*" UpgradeCode="{6AAB7BEE-AFE3-48A4-96F1-25E5EDCC642B}" Version="2.0.0.0" Language="1033" Name="Corp Services" Manufacturer="My Company">
    <Package InstallerVersion="300" Compressed="yes"/>

    <Media Id="1" Cabinet="myapplication.cab" EmbedCab="yes" />

    <!-- Step 1: Define the directory structure -->

    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramMenuFolder">
        <Directory Id="ApplicationProgramsFolder">
          <Directory Id="COMPANYROOTDIRECTORY" Name="My Company">
            <Directory Id="APPLICATIONROOTDIRECTORY" Name="Corp Services"/>
          </Directory>
        </Directory>
      </Directory>
      
      <Directory Id="ProgramFilesFolder">
        <Directory Id="ApplicationProgamsFolder" Name="Corp Services"/>
          <Directory Id="ICONFOLDER" Name="Icons"/>
        </Directory>
    </Directory>

    <Binary Id="UninstallAction" SourceFile="..\SetupProject1\bin\Debug\UninstalllegacyCorpServices.exe"></Binary>
    
    <CustomAction Id="UninstallLegacyCorpServicesAction" BinaryKey="UninstallAction" ExeCommand="run" Execute="immediate" Return="check" Impersonate="no">
    </CustomAction>


    <!-- Step 2: Add files to your installer package -->
    <DirectoryRef Id="ICONFOLDER">
      <Component Id="MyIcon" Guid="{A8A872E3-E9D0-4E25-BD65-3EA2DC0D4445}">
        <File Id="MyconFile" Source="My-Icon.ico" KeyPath="yes" Checksum="yes"></File>
      </Component>
    </DirectoryRef>

    <DirectoryRef Id="APPLICATIONROOTDIRECTORY">
      <Component Id="CRM" Guid="{770E9C17-8796-494A-ACB1-B1C5C52DEE8A}">
        <File Id="CRMFile" Source="CRM.lnk" KeyPath="yes"/>
      </Component>

      <Component Id="MYNOTEPAD" Guid="{770E9C18-8796-494A-ACB1-B1C5C52DEE8A}">
        <Shortcut Id="My_Notepad" Name="My Notepad" Target="notepad.exe" Arguments="notepad.exe" Hotkey="0" IconIndex="0" Show="normal" />
      </Component>
      
    </DirectoryRef>
    

    <!-- <DirectoryRef Id="StartMenuFolder">-->
    <DirectoryRef Id="ApplicationProgramsFolder">
      <Component Id="ApplicationShortcut" Guid="{CD186813-D08F-4A80-A4D5-F91254E28D46}">
        <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
        <RemoveFolder Id="ApplicationShortcut" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\My Company\Corp Services" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
      </Component>
    </DirectoryRef>

    <!-- Step 3: Tell WiX to install the files -->
    <Feature Id="MainApplication" Title="Main Application" Level="1">
      <ComponentRef Id="CRM" />
      <ComponentRef Id="MyIcon" />
      <ComponentRef Id="ApplicationShortcut" />
      <ComponentRef Id="MYNOTEPAD" />
    </Feature>
    <InstallExecuteSequence>
      <Custom Action="UninstallLegacyCorpServicesAction" Before="InstallFiles"></Custom>
    </InstallExecuteSequence>
  </Product>

</Wix>

Open in new window

0
 

Author Comment

by:VBBRett
ID: 40381356
I'm a little confused.  I was under the impression that Wix only uses exe files for shortcuts, I'm only installing lnk files and one ico file.  Is it possible to have two install directories if unrelated paths that don't inherit each other?  How is this done?  I can't find any examples pertaining to what I'm asking.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 40381364
> I was under the impression that Wix only uses exe files for shortcuts, I

Shortcut can be to a file in the installation (any file, not only executable), or it can be any command line.

>  Is it possible to have two install directories if unrelated paths that don't inherit each other?

in the sample I posted, .lnk files go into directory under start menu, and .ico file goes under directory under program files.

> How is this done?  I can't find any examples pertaining to what I'm asking.

The example is right here in my previous comment.
0
 

Author Closing Comment

by:VBBRett
ID: 40391195
Thank you very much for your help.  You helped a great big deal and I appreciate it.
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question