简体   繁体   English

WiX安装程序.msi不会安装附加的.lib和.dll文件

[英]WiX installer .msi doesn't install the attached .lib and .dll files

So I have a fully working Product.wxs file that installs a nifty Signature drawing program. 因此,我有一个可以正常运行的Product.wxs文件,该文件安装了一个漂亮的Signature绘图程序。 I added a TestLibrary project with a TestClass with a very basic Add(int, int) method, and used it in my program just for testing purposes, then harvested the class' directory with heat (and ran it through and XSLT file for formatting), linked the Output.wxs to the project, referenced the ComponentGroup, and tried to install the whole thing together, hoping that the class would be installed along, and the software could run. 我使用基本的Add(int,int)方法添加了带有TestClass的TestLibrary项目,并将其用于程序中只是出于测试目的,然后加热收集类的目录(并通过XSLT文件进行格式化) ,将Output.wxs链接到项目,引用ComponentGroup,并尝试将整个组件安装在一起,希望可以一​​起安装该类,并且软件可以运行。 This is not the case, it builds and installs flawlessly, just for the installed .exe to fail on launch. 事实并非如此,它可以完美地构建和安装,只是为了使已安装的.exe在启动时失败。

Here's the Product.wxs: 这是Product.wxs:

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Product Id="6daf7a49-43a8-403b-8d15-96197c8751cc" Name="SetupProject_Sig" Language="1033" Version="1.0.0.0" Manufacturer="VTC" UpgradeCode="f2ad826c-59b9-4f9f-af0d-8c9d80030605">
        <Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />

        <Condition Message="You need to be an administrator to install this product.">
        Privileged
        </Condition>

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

        <Feature Id="ProductFeature" Title="SetupProject_Sig" Level="1">
            <ComponentGroupRef Id="ProductComponents" />
            <ComponentGroupRef Id="ComComponents" />
        </Feature>

        <Property Id="ApplicationFolderName" Value="Signature" />
        <Property Id="WixAppFolder" Value="WixPerMachineFolder" />

        <WixVariable Id="WixUISupportPerUser" Value="1" Overridable="yes" />
        <WixVariable Id="WixUISupportPerMachine" Value="1" Overridable="yes" />

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

    </Product>

  <Fragment>
    <Directory Id="TARGETDIR" Name="SourceDir">
      <Directory Id="ProgramFilesFolder">
        <Directory Id="APPLICATIONFOLDER" Name="SetupProject_Sig" />
      </Directory>
    </Directory>
  </Fragment>

    <Fragment>
        <Feature Id="Complete" Title="Signature Tosz 1.0" Description="All files." Level="1" Display="expand" ConfigurableDirectory="APPLICATIONFOLDER">
            <Feature Id="MainProgram" Title="Program" Description="The main executable." Level="1">
                <ComponentRef Id="MainExecutable" />
                <ComponentRef Id="HelperLibrary" />
                <ComponentRef Id="ProgramMenuDir" />
            </Feature>
            <Feature Id="Documentation" Title="Description" Description="Instruction manual." Level="1000">
                <ComponentRef Id="Manual" />
                <Condition Level="1">FILEEXISTS</Condition>
            </Feature>
        </Feature>
    </Fragment>

  <Fragment>
    <ComponentGroup Id="ProductComponents" Directory="APPLICATIONFOLDER">
            <Component Id="ProductComponent" Guid="b3594fac-7524-4529-8874-5811705996b8">
                <File Source="$(var.Control_Sig.TargetPath)" />
            </Component>
        </ComponentGroup>
  </Fragment>

    <Fragment>
        <DirectoryRef Id="TARGETDIR">
            <Component Id="RegistryComp">
                <RegistryKey Id="ToszRegApplicationfolder" Root="HKLM" Key="Software\VTC\Tosz 1.0" Action="createAndRemoveOnUninstall">
                    <RegistryValue Type="string" Name="APPLICATIONFOLDER" Value="[APPLICATIONFOLDER]" />
                    <RegistryValue Type="integer" Name="Flag" Value="0" />
                </RegistryKey>
            </Component>
        </DirectoryRef>
    </Fragment>
</Wix>

The pre-build heat command: 预制热指令:

call "%wix%\bin\heat.exe" dir "$(SolutionDir)\TestLibrary\bin\Debug" -var "var.TargetDir" -gg -g1  -srd -cg ComComponents -template fragment -out "$(ProjectDir)\Output.wxs" -v -t "$(ProjectDir)\bin\Debug\Filter.xslt"

Output.wxs 输出.wxs

<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
    <Fragment>
        <DirectoryRef Id="TARGETDIR" />
    </Fragment>
    <Fragment>
        <ComponentGroup Id="ComComponents">
            <Component Id="cmp278E5D4E5835479434800F8B4056EB4B" Directory="TARGETDIR" Guid="A09371FD-ACE5-474E-B1B8-D9C83CF05497">
                <Class Id="{DB173953-D21D-3F29-BC10-C6299EBD2BFF}" Context="InprocServer32" Description="TestLibrary.TestClass" ThreadingModel="both" ForeignServer="mscoree.dll">
                    <ProgId Id="TestLibrary.TestClass" Description="TestLibrary.TestClass" />
                </Class>
                <File Id="fil296E15219B07AF9559E0660E87293FC3" KeyPath="yes" Source="$(var.TargetDir)\TestLibrary.dll" />
                <RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\Implemented Categories\{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}" Value="" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32\1.0.0.0" Name="Class" Value="TestLibrary.TestClass" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32\1.0.0.0" Name="Assembly" Value="TestLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32\1.0.0.0" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32\1.0.0.0" Name="CodeBase" Value="file:///[#fil296E15219B07AF9559E0660E87293FC3]" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32" Name="Class" Value="TestLibrary.TestClass" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32" Name="Assembly" Value="TestLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32" Name="RuntimeVersion" Value="v4.0.30319" Type="string" Action="write" />
                <RegistryValue Root="HKCR" Key="CLSID\{DB173953-D21D-3F29-BC10-C6299EBD2BFF}\InprocServer32" Name="CodeBase" Value="file:///[#fil296E15219B07AF9559E0660E87293FC3]" Type="string" Action="write" />
            </Component>

            <Component Id="cmp5BD81C93D46AA48BFAA1819DF54A67EB" Directory="TARGETDIR" Guid="86402057-DA0F-4B8E-BD0B-4973739A4008">
                <File Id="fil108FAB265F126BACEED88B56AB065A99" KeyPath="yes" Source="$(var.TargetDir)\TestLibrary.tlb">
                    <TypeLib Id="{A9413C7C-F0C0-4DB1-82E3-116C411A0342}" Description="TestLibrary" HelpDirectory="TARGETDIR" Language="0" MajorVersion="1" MinorVersion="0">
                        <Interface Id="{A13FF8B0-AC7C-33E5-B0F3-5366304512AC}" Name="_TestClass" ProxyStubClassId32="{00020424-0000-0000-C000-000000000046}" />
                    </TypeLib>
                </File>
            </Component>
        </ComponentGroup>
    </Fragment>
</Wix>

The added line in Main() for testing: Main()中添加的行用于测试:

System.Diagnostics.Debug.WriteLine(new TestLibrary.TestClass().Add(5, 3));

I've been trying to fix it for two days, and it's driving me nuts. 我已经尝试修复了两天,这让我发疯了。 Can't seem to figure out where it goes wrong, the Output looks perfect, the class should be getting installed, and yet the Signature program fails to launch. 似乎无法弄清楚哪里出了问题,输出看起来很完美,应该安装了该类,但是Signature程序无法启动。

Thanks in advance! 提前致谢!

I don't have the intricate COM knowledge that Phil has so here's how I debug it. 我不具备Phil所具备的COM方面的复杂知识,因此这里是我调试它的方法。

Fire up a clean snapshotted VM. 启动干净的快照虚拟机。 Install your MSI. 安装您的MSI。 Run a registry snapshot differencing tool such as InstallWatcher Pro. 运行注册表快照差异工具,例如InstallWatcher Pro。 Run regsvr32.exe your.dll Take a another snapshot and compare. 运行regsvr32.exe your.dll拍摄另一个快照并进行比较。 Run your program to confirm regsvr32.exe fixed the problem. 运行您的程序,以确认regsvr32.exe解决了该问题。 If not, look elsewhere for the source of your troubles. 如果没有,请在别处寻找麻烦的根源。 Roll the VM snapshot back. 回滚虚拟机快照。

If so, analyze the differences and author it into your .wxs and rebuild. 如果是这样,请分析差异并将其创作到您的.wxs中并进行重建。 Rinse and repeat. 冲洗并重复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM