如何使用wix从Web安装程序安装.net 4.5

时间:2017-03-08 18:38:45

标签: wix

第一次使用Wix很抱歉,如果我的问题显得愚蠢。我在这里看看我的答案,似乎我需要使用一个包。

我的主要wxs页面包含我要安装的所有注册表,文件数据库但是如何在此文件中包含一个包?我有这个:

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

  </Bundle>
    <Product Id="*" Name="IMy Application Name" Language="1033" Version="2.0.0.0" Manufacturer="My Company Name" UpgradeCode="5d4e4839-11b8-403c-a440-796507b2f057">
   <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine"  InstallPrivileges="elevated"   />

    <MajorUpgrade 
      AllowDowngrades="no"
      AllowSameVersionUpgrades="no"
      IgnoreRemoveFailure="no"
      DowngradeErrorMessage="loc.NewerVersionInstalled"
      Schedule="afterInstallInitialize"/>


ERRORS FROM HERE!
    <Bundle Name="Prog" Version="1.0.0.0" Manufacturer="my Corporation" UpgradeCode="*">
      <Chain>

        <PackageGroupRef Id="Netfx45FullPackage" />
      </Chain>
    </Bundle>
    <Fragment>
      <PackageGroup Id="Netfx45FullPackage">
        <ExePackage Id="Netfx45Xxx" Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="no" InstallCommand="/q" SourceFile="..\SetupProject\dotnetfx45_full_x86_x64.exe" DetectCondition="(Netfx4FullVersion=&quot;4.5.50709&quot;) AND (NOT VersionNT64 OR (Netfx4x64FullVersion=&quot;4.5.50709&quot;))" InstallCondition="(VersionNT &gt;= v6.0 OR VersionNT64 &gt;= v6.0) AND (NOT (Netfx4FullVersion=&quot;4.5.50709&quot; OR Netfx4x64FullVersion=&quot;4.5.50709&quot;))" />
TO HERE!

        <MsiPackage Id="MyProg" Cache="no" Compressed="no" DisplayInternalUI="yes" Vital="yes" SourceFile="$(var.installerPath)\MyProgCore.msi" />
      </PackageGroup>
    </Fragment>**


    <InstallUISequence>
      <Custom Action='PreventDowngrading' After='FindRelatedProducts'>NEWPRODUCTFOUND</Custom>
    </InstallUISequence>

    <CustomAction Id='PreventDowngrading' Error='Newer version already installed' />

    <Property Id="WIXUI_INSTALLDIR" Value="APPLICATIONROOTDIRECTORY" />


    <UI>
      <UIRef Id="WixUI_Minimal" />
      <Publish 
        Dialog="ExitDialog"
        Control="Finish"
        Event="DoAction"
        Value="LaunchApplication">WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed
      </Publish>
    </UI>


    <Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch My Application" />
    <Property Id="WixShellExecTarget" Value="[#InformedWorker]" />
    <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />



    <MediaTemplate EmbedCab="yes"/>


   <PropertyRef Id="NETFRAMEWORK45"/>
    <Condition Message="This application requires .NET Framework 4.5. Please install the .NET Framework then run this installer again.">
      <![CDATA[Installed OR NETFRAMEWORK20]]>
    </Condition>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="APPLICATIONROOTDIRECTORY" Name="Informed Worker"/>
        <Directory Id="OriginalFilesFolder" Name="OriginalFiles"  SourceName="SourceFiles"/>
        <Directory Id="CopiedFilesFolder" Name="My Application Name" />
      </Directory>
      <Directory Id="CommonAppDataFolder">
        <Directory Id="ConfigFOLDER" Name="My Application Name">
          <Directory Id="EmptyDataFolderDir" Name="Data" />
          <Directory Id="EmptyLogFolderDir" Name="Log" />
          <Directory Id="RegComponents" Name="Reg" />
        </Directory>
      </Directory>
      <!-- Step 1: Define the directory structure -->
      <Directory Id="ProgramMenuFolder">
        <Directory Id="ApplicationProgramsFolder" Name="My Application Name"/>
        <Directory Id="DesktopFolder" Name="Desktop"></Directory>
      </Directory>
    </Directory>

    <DirectoryRef Id="APPLICATIONROOTDIRECTORY">
      <Component Id="InformedWorker" Guid="*">
        <File Id="InformedWorker" Source="SourceFiles\MyApp.exe" KeyPath="yes" Checksum="yes"/>
      </Component>
    </DirectoryRef>

    <Feature Id="MainApplication" Title="Main Application" Level="1">
      <ComponentRef Id="MyApp" />
    </Feature>

    <Feature Id="ProductFeature" Title="Setup" Level="1">
      <ComponentGroupRef Id="DataFolderComponent" />
      <ComponentGroupRef Id="LogFolderComponent" />
      <ComponentGroupRef Id="RegComponents" />
      <ComponentGroupRef Id="FilesFolder" />
      <ComponentGroupRef Id="DBFolder" />
    </Feature>

    <Icon Id="InformedWorker" SourceFile="SourceFiles\MyApp.exe" />
    <Property Id="ARPPRODUCTICON" Value="My Application Name" />
  </Product>

  <Fragment>
    <ComponentGroup Id="DataFolderComponent" Directory="EmptyDataFolderDir">
      <Component Id="CMP_MyEmptyDataDir" Guid="85DAD4AE-6404-4A40-B713-43538091B9D3" KeyPath="yes">
        <CreateFolder />
      </Component>
    </ComponentGroup>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="LogFolderComponent" Directory="EmptyLogFolderDir">
      <Component Id="CMP_MyEmptyLogDir" Guid="a4594ec9-3101-4627-8ee7-d60d0a9b1f63" KeyPath="yes">
        <CreateFolder />
      </Component>
    </ComponentGroup>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="RegComponents" Directory="APPLICATIONROOTDIRECTORY">
      <Component Id="RegistryEntries" Guid="9AB04D89-19B5-4729-9CD5-656C8C6B833F">
        <RegistryKey Root="HKCR" Key="My Application Name">
          <RegistryValue Type="string" Name="ClientRef" Value=""/>
        </RegistryKey>
      </Component>
    </ComponentGroup>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="FilesFolder" Directory="OriginalFilesFolder">
      <Component Id="EXE_File" Guid="*">
        <File Id="AppExe" Source="SourceFiles\MyApp.exe" KeyPath="yes">
          <CopyFile Id="Copy_EXE" DestinationDirectory="APPLICATIONROOTDIRECTORY" DestinationName="MyApp.exe" />
        </File>
      </Component>
    </ComponentGroup>
  </Fragment>

  <Fragment>
    <ComponentGroup Id="DBFolder" Directory="OriginalFilesFolder">
      <Component Id="DB_File" Guid="a4eeb7a3-635c-41c3-b8c8-35c9c4f46d97">
        <File Id="AppDB" Source="SourceFiles\Data.db3" KeyPath="yes">
          <CopyFile Id="Copy_DB" DestinationDirectory="EmptyDataFolderDir" DestinationName="MyDB.db3" />
        </File>
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>

但它不喜欢包含我的包..?

1 个答案:

答案 0 :(得分:0)

捆绑包是单独的项目。一个项目为您的MSI和一个为您的捆绑。