Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/307.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# WiX installer.msi不';t安装附加的.lib和.dll文件_C#_Xslt_Wix_Windows Installer_Toolkit - Fatal编程技术网

C# WiX installer.msi不';t安装附加的.lib和.dll文件

C# WiX installer.msi不';t安装附加的.lib和.dll文件,c#,xslt,wix,windows-installer,toolkit,C#,Xslt,Wix,Windows Installer,Toolkit,所以我有一个完整的Product.wxs文件,它安装了一个漂亮的签名绘图程序。我用一个非常基本的Add(int,int)方法添加了一个TestLibrary项目和一个TestClass,并在我的程序中仅用于测试目的,然后用heat获取类的目录(并运行它和XSLT文件进行格式化),将Output.wxs链接到项目,引用ComponentGroup,并试图一起安装整个程序,希望该类能够一起安装,并且软件能够运行。事实并非如此,它构建和安装都完美无缺,只是为了让已安装的.exe在启动时失败 以下是Pr

所以我有一个完整的Product.wxs文件,它安装了一个漂亮的签名绘图程序。我用一个非常基本的Add(int,int)方法添加了一个TestLibrary项目和一个TestClass,并在我的程序中仅用于测试目的,然后用heat获取类的目录(并运行它和XSLT文件进行格式化),将Output.wxs链接到项目,引用ComponentGroup,并试图一起安装整个程序,希望该类能够一起安装,并且软件能够运行。事实并非如此,它构建和安装都完美无缺,只是为了让已安装的.exe在启动时失败

以下是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>
Output.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>
我两天来一直想把它修好,快把我逼疯了。似乎无法找出哪里出了问题,输出看起来很完美,应该安装类,但签名程序无法启动


提前谢谢

我没有Phil那样复杂的COM知识,所以下面是我调试它的方法

启动一个干净的快照VM。 安装MSI。 运行注册表快照差异化工具,如InstallWatcher Pro。 运行regsvr32.exe或您的.dll 拍摄另一张快照并进行比较。 运行程序以确认regsvr32.exe已修复该问题。如果不是,就到别处找麻烦的根源。 回滚VM快照


如果是这样,请分析差异并将其编入.wxs并重新生成。冲洗并重复。

我不相信您只是在COM案例中使用“new”。毕竟,“new”中没有魔法知道如何获取Dll。您应该从类似Activator.CreateInstance(Type.GetTypeFromProgID(ProgID))的东西开始,它确实使用ProgID来查找Dll和类。非常感谢您的帮助,添加“Activator.CreateInstance(Type.GetTypeFromProgID(“TestLibrary.TestClass”);”帮助查找.Dll,现在可以工作了:)谢谢您的帮助,这对我帮助很大!我并不总是涉及到相关的代码库,所以我通常要求COM开发人员创建一个“测试”方法,并提供一个示例VBScript来使用它。在我尝试在干净的环境中使用之前,我先验证它在他们的环境中是否有效。信任但验证。。。
<?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>
System.Diagnostics.Debug.WriteLine(new TestLibrary.TestClass().Add(5, 3));