维克斯:可执行文件中未找到子目录的DLL

问题描述 投票:0回答:1

我正尝试创建使用维克斯一个MSI,并有安装文件夹使用给定结构,在这种情况下,把第三方dll's在一个名为lib子文件夹。

问题是,MyApplication.exe崩溃。调试告诉我它无法找到Interactions.dll。如果我把DLL的安装文件夹,而不是在子文件夹中正常工作。

<Feature Id="ProductFeature" Title="MyApplication" Level="1">
    <ComponentGroupRef Id="Executable"/>
    <ComponentGroupRef Id="ProductComponents"/>
</Feature>

<Fragment>
  <Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="ProgramFilesFolder">
      <Directory Id="Organisation" Name="OrganizationFolder">
        <Directory Id="INSTALLFOLDER" Name="MyApplication">
          <Directory Id="lib" Name="lib"/>
        </Directory>
      </Directory>
    </Directory>
  </Directory>
</Fragment>

<Fragment>
  <ComponentGroup Id="Executable" Directory="INSTALLFOLDER">
    <Component Id="MyApplication.exe" Guid="*">
      <File Id="MyApplication.exe" Name="MyApplication.exe" Source="$(var.MyApplication_TargetDir)MyApplication.exe" Vital="yes" />
    </Component>
  </ComponentGroup>
</Fragment>

<Fragment>
  <ComponentGroup Id="ProductComponents" Directory="lib">
    <Component Id="Microsoft.Expression.Interactions.dll" Guid="*">
          <File Id="Microsoft.Expression.Interactions.dll" Name="Microsoft.Expression.Interactions.dll" Source="$(var.MyApplication_TargetDir)Microsoft.Expression.Interactions.dll" />
    </Component>
  </ComponentGroup>
</Fragment>
c# wix
1个回答
0
投票

这是无关的WiX,而是是.NET运行库如何定位程序集 - 它不知道你想要搜索的lib子目录的Microsoft.Expression.Interactions.dll。你可以使用一个探测元件在应用程序的配置文件来告诉它在哪里可以找到这个问题和其他相关组件(详见here):

<configuration>  
   <runtime>  
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">  
         <probing privatePath="lib"/>  
      </assemblyBinding>  
   </runtime>  
</configuration> 

另外要注意,按照约定,相关组件通常是在“bin”的子目录,而不是“LIB”;至少,这是由ASP净使用的惯例,所以你可能会考虑使用该约定自己。

© www.soinside.com 2019 - 2024. All rights reserved.