1

我正在开发一个 wix 代码来创建一个 msi。我已将所有组件和库添加到我的 wix 项目中。但是,我无法根据需要创建 msi。请帮帮我。这是我的代码,

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

<Product Name='SmartViewer'
          Id="*"
          Language='1033'
          Codepage='1252'
          Version='1.0.0'
          UpgradeCode='9C5E4073-EFDE-419B-935D-CE2632BC560E'>

    <Package Keywords='Installer,MSI'
             InstallerVersion='100'
             Languages='1031'
             Compressed='yes'
             SummaryCodepage='1252' />

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

    <Directory Id="TARGETDIR" Name="SourceDir">
        <Directory Id="ProgramFilesFolder">
            <Directory Id="MyProgramDir" Name="myproject" >
                <Directory Id="INSTALLFOLDER" Name="proj1" />
            </Directory>
        </Directory>

    <DirectoryRef Id="INSTALLFOLDER">
        <Component Id='MainExecutable' Guid='*'>
            <File Id='ExecutableFile' Name='mv.exe' DiskId='1' Source='mv.exe' KeyPath='yes'/>
        </Component>
        <Directory Id="imageformats" Name="imageformats">
            <Component Id='jpeg4Library' Guid='*'>
                <File Id='jpeg4' Name='jpeg4.dll' DiskId='1' Source='jpeg4.dll' KeyPath='yes' />
            </Component>
        </Directory>

        <Component Id='Network4Library' Guid='*'>
            <File Id='Network4' Name='Network4.dll' DiskId='1' Source='Network4.dll' KeyPath='yes' />
        </Component>

        <Component Id='Multimedia4Library' Guid='*'>
            <File Id='Multimedia4' Name='Multimedia4.dll' DiskId='1' Source='Multimedia4.dll' KeyPath='yes' />
        </Component>

        <Component Id='QtGui4Library' Guid='*'>
            <File Id='Gui4' Name='Gui4.dll' DiskId='1' Source='Gui4.dll' KeyPath='yes' />
        </Component>

        <Component Id='Designer4Library' Guid='*'>
            <File Id='Designer4' Name='Designer4.dll' DiskId='1' Source='Designer4.dll' KeyPath='yes' />
        </Component>

        <Component Id='Core4Library' Guid='*'>
            <File Id='Core4' Name='Core4.dll' DiskId='1' Source='Core4.dll' KeyPath='yes' />
        </Component>


        <Component Id='libmfxsw32Library' Guid='*'>
            <File Id='libmfxsw32' Name='libmfxsw32.dll' DiskId='1' Source='libmfxsw32.dll' KeyPath='yes' />
        </Component>

        <Component Id='libiomp5mdLibrary' Guid='*'>
            <File Id='libiomp5md' Name='libiomp5md.dll' DiskId='1' Source='libiomp5md.dll' KeyPath='yes' />
        </Component>

        <Component Id='ippcore7.1Library' Guid='*'>
            <File Id='ippcore7.1' Name='ippcore-7.1.dll' DiskId='1' Source='ippcore-7.1.dll' KeyPath='yes' />
        </Component>

        <Component Id='ippccw77.1Library' Guid='*'>
            <File Id='ippccw77.1' Name='ippccw7-7.1.dll' DiskId='1' Source='ippccw7-7.1.dll' KeyPath='yes' />
        </Component>

        <Component Id='ippccv87.1Library' Guid='*'>
            <File Id='ippccv87.1' Name='ippccv8-7.1.dll' DiskId='1' Source='ippccv8-7.1.dll' KeyPath='yes' />
        </Component>

        <Component Id='ippccs87.1Library' Guid='*'>
            <File Id='ippccs87.1' Name='ippccs8-7.1.dll' DiskId='1' Source='ippccs8-7.1.dll' KeyPath='yes' />
        </Component>

        <Component Id='ippccp87.1Library' Guid='*'>
            <File Id='ippccp87.1' Name='ippccp8-7.1.dll' DiskId='1' Source='ippccp8-7.1.dll' KeyPath='yes' />
        </Component>

        <Component Id='ippccg97.1Library' Guid='*'>
            <File Id='ippccg97.1' Name='ippccg9-7.1.dll' DiskId='1' Source='ippccg9-7.1.dll' KeyPath='yes' />
        </Component>

        <Component Id='ippcc7.1Library' Guid='*'>
            <File Id='ippcc7.1' Name='ippcc-7.1.dll' DiskId='1' Source='ippcc-7.1.dll' KeyPath='yes' />
        </Component>

        <Component Id='EULALibrary' Guid='*'>
            <File Id='EULA' Name='EULA.rtf' DiskId='1' Source='EULA.rtf' KeyPath='yes' />
        </Component>
    </DirectoryRef> 


    <Directory Id="ProgramFilesFolder">
        <Directory Id="MyProgramDir" Name="myproj" >
                <Directory Id="INSTALLFOLDER" Name="proj1" /
                    <Component Id="TextFileComponent" Guid="*">
                        <File Id="TextFile" Name="Logs.txt" DiskId="1"
                              Source="Logs.txt" KeyPath="yes" />
                    </Component>
        </Directory>
    </Directory>

    <Directory Id="DesktopFolder">
        <Component Id="ExecutableFileShortcutComponent" Guid="*">
            <Shortcut Id="ExecutableFileShortcut" Name="smart viewer" 
                  Description="Shortcut To Executable File"
                  Target="[INSTALLFOLDER]mv.exe" />
    </Directory>

    <Directory Id="ProgramMenuFolder">
        <Directory Id="MyProgramDir" Name="myproj">
            <Component Id="ExecutableFileShortcutComponent" Guid="*">
                <Shortcut Id="ExecutableFileShortcut" Name="smart viewer"
                      Description="Shortcut To Executable File"
                      Target="[INSTALLFOLDER]mv.exe" />

        </Component>
     </Directory>

  </Product>
 </Wix>

组件没有获取 dll 路径。我尝试将路径传递给文件 id 中的源,但我仍然发现相同的问题。期待一个好的建议。

4

2 回答 2

1

您需要引用文件的完整路径:

<File Id="Microsoft.Practices.Unity"
      Name="jpeg4.dll"
      Source="$(var.BuildOutputDir)\jpeg4.dll" />

$(var.BuildOutputDir)文件夹的完整路径在哪里。如果这些文件在另一个引用项目的输出中,那么您可以使用$(var.OtherProject.TargetDir)

于 2013-02-22T11:41:24.430 回答
0

您的文件不包含有效的 XML。以下片段已损坏。

<Directory Id="ProgramFilesFolder">
    <Directory Id="MyProgramDir" Name="myproj" >
            <Directory Id="INSTALLFOLDER" Name="proj1" /
                <Component Id="TextFileComponent" Guid="*">
                    <File Id="TextFile" Name="Logs.txt" DiskId="1"
                          Source="Logs.txt" KeyPath="yes" />
                </Component>
    </Directory>
</Directory>

线

            <Directory Id="INSTALLFOLDER" Name="proj1" /

应该

            <Directory Id="INSTALLFOLDER" Name="proj1" >

</Directory>缺少一个。您还应该</Component>在两个位置添加。尝试加载 .WXS 文件时指向无效 XML 的 WiXEdit。

此外,您应该添加一个<feature>.

于 2013-02-22T10:10:12.317 回答