Link to home
Start Free TrialLog in
Avatar of VBBRett
VBBRett

asked on

Wix Installation Help Needed

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
Avatar of Vadim Rapp
Vadim Rapp
Flag of United States of America image

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

Avatar of VBBRett
VBBRett

ASKER

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.
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.
Avatar of VBBRett

ASKER

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.
Avatar of VBBRett

ASKER

Would you be able to explain how I do that with my xml if I were to post my code?
Sure.
By the way, installing shortcuts as files is quite exotic. More straightforward would be to install them as actual shortcuts.
Avatar of VBBRett

ASKER

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

ASKER CERTIFIED SOLUTION
Avatar of Vadim Rapp
Vadim Rapp
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of VBBRett

ASKER

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.
> 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.
Avatar of VBBRett

ASKER

Thank you very much for your help.  You helped a great big deal and I appreciate it.