0

actually I just started learning wix today from the http://wixtoolset.org/documentation/

after reading and learning few things I got some confidence to start creating my first wix project and the configuration for the same is here:

<?xml version="1.0" encoding="UTF-8"?>
   <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

     <Product Id="*" Name="PersonalDailyInstaller" Language="1033" Version="1.0.0.0"
       Manufacturer="Muhammad Sufiyan Shaikh" UpgradeCode="1327de13-b713-4cee-9778-be9c7460c0aa">
     <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
     <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

     <MediaTemplate />
     <!-- <MediaTemplate EmbedCab="yes" /> -->

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

  <Fragment>

     <Directory Id="TARGETDIR" Name="SourceDir">
       <Directory Id="ProgramFilesFolder">
          <Directory Id="INSTALLFOLDER" Name="PersonalDaily" />
       </Directory>
     </Directory>

     <DirectoryRef Id="INSTALLFOLDER">
        <Component Id="MainExe" Guid="D7DC3991-2EE4-4BE5-B8B4-D15AC05592F3">
           <File Id="MainExe" Source="bin\Debug\PersonalDaily.exe" KeyPath="yes" Checksum="yes"/>
        </Component>
        <Component Id="DataPD" Guid="9DF21E80-F608-416A-BBAE-92AB3DA4CAE6">
           <File Id="DataPD" Source="bin\Debug\data.PD" KeyPath="yes" Checksum="yes"/>
        </Component>
     </DirectoryRef>

   </Fragment>

   <Fragment>
      <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
         <Component Id="ProductComponent">
           <File Source="$(var.PersonalDaily.TargetPath)" />
         </Component>
      </ComponentGroup>
  </Fragment>
</Wix>

now when I build the wix project I am getting below error:

Severity Code Description Project File Line Suppression State Error Found orphaned Component 'MainExe'. If this is a Product, every Component must have at least one parent Feature. To include a Component in a Module, you must include it directly as a Component element of the Module element or indirectly via ComponentRef, ComponentGroup, or ComponentGroupRef elements. PersonalDailyInstaller C:\Users\muham\documents\visual studio 2015\Projects\PersonalDaily\PersonalDailyInstaller\Product.wxs 25

any help or work around would be a great help for me. thanks in advance.

4

1 回答 1

0

thanks everyone, actually I got it working by doing some changes and experiment on it, and updated working code is here:

and yes for sure, If anyone has better approach then this please post your answer...

<?xml version="1.0" encoding="UTF-8"?>
 <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">

 <Product Id="*" Name="PersonalDailyInstaller" Language="1033" Version="1.0.0.0"
   Manufacturer="Muhammad Sufiyan Shaikh" UpgradeCode="1327de13-b713-4cee-9778-be9c7460c0aa">
 <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
 <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />

 <MediaTemplate />
 <!-- <MediaTemplate EmbedCab="yes" /> -->

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

<Fragment>

 <Directory Id="TARGETDIR" Name="SourceDir">
   <Directory Id="ProgramFilesFolder">
      <Directory Id="INSTALLFOLDER" Name="PersonalDaily" />
   </Directory>
 </Directory>

 <ComponentGroup  Id="Dlls"  Directory="INSTALLFOLDER">
    <Component Id="DataPD" Guid="9DF21E80-F608-416A-BBAE-92AB3DA4CAE6">
       <File Id="DataPD" Source="..\PersonalDaily\bin\Debug\data.PD" KeyPath="yes" Checksum="yes"/>
    </Component>
 </ComponentGroup>

</Fragment>

<Fragment>
  <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
     <Component Id="ProductComponent">
       <File Source="$(var.PersonalDaily.TargetPath)" />
     </Component>
   </ComponentGroup>
 </Fragment>
</Wix>
于 2016-02-24T08:12:22.893 回答