使用Wix安装程序安装后,无法从配置文件中读取

时间:2016-08-24 13:58:18

标签: .net wix excel-addins

在我的Excel加载项项目中,我正在从app.config文件中读取一些数据(重命名为iFMExcelAddIn.dll.config),但在通过Wix安装时,我的加载项不是从配置中读取数据文件,即使我正在安装配置文件以及安装程序。我不知道我在这里失踪了什么。我没有太多使用Wix安装程序的经验,所有谷歌搜索都没有给出有益的结果。

我想这与我安装配置文件的方式有关。以下是我用来添加配置文件的代码。它是组件组中的最后一个组件。 AddinFILe的路径也是../iFMExcelAddIn/$(Configuration)/。如果您需要更多信息,我希望这些信息可以让我知道。

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

<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">

<Component Id="iFMExcelAddIn_vsto_Component">
    <File Id="iFMExcelAddIn_vsto" KeyPath="yes"
          Name="iFMExcelAddIn.vsto" Source="$(var.AddinFiles)"></File>
</Component>

<Component Id="iFMExcelAddIn_dll_manifest_Component">
   <File Id="iFMExcelAddIn_dll_manifest" KeyPath="yes"
          Name="iFMExcelAddIn.dll.manifest" Source="$(var.AddinFiles)">     </File>
  </Component>

  <Component Id="MSOfficeToolsCommon_dll_Component">
    <File Id="MSOfficeToolsCommon_dll" KeyPath="yes"
          Name="Microsoft.Office.Tools.Common.v4.0.Utilities.dll"
          Source="$(var.AddinFiles)"></File>
  </Component>

  <Component Id="MSOfficeToolsExcel_dll_Component">
    <File Id="MSOfficeToolsExcel_dll" KeyPath="yes"
          Name="Microsoft.Office.Tools.Excel.dll"
          Source="$(var.AddinFiles)"></File>
  </Component>

  <Component Id="iFMExcelAddIn_dll_Component" >
    <File Id="iFMExcelAddIn_dll" KeyPath="yes"
          Name="iFMExcelAddIn.dll" Source="$(var.AddinFiles)" />
  </Component>


  <Component Id="iFMExcelAddIn_dll_Config_Component" >
    <File Id="iFMExcelAddIn_dll_Config" KeyPath="yes"
          Name="iFMExcelAddIn.dll.config" Source="$(var.AddinFiles)" />
  </Component>

  <Component Id="iFMServiceDll_Component">
    <File Id="iFMServiceDll" Name="IFM.Service.dll" Source="$(var.AddinFiles)" SelfRegCost="1">
    </File>
  </Component>

</ComponentGroup>

1 个答案:

答案 0 :(得分:0)

经过近两天的搜索并了解app.config实际上是如何工作的,我找到了解决这个问题的方法。实际上在部署excel外接程序后,我发现它实际上是试图从路径中读取app.config文件---&gt;安装云端硬盘&gt;:\ Program Files \ Microsoft Office \ Office12 \ EXCEL.EXE.config。我甚至考虑将我的配置条目放入excel.exe.config文件以使其工作,但由于它不是正确的方式,我发现我们需要更改我们指定vsto addin路径的注册表项。这种变化看起来很愚蠢

manifest注册表项需要以file:///.ie为前缀,而不是&#34; [TARGETDIR] ExcelAddIn.vsto | vstolocal&#34;:我们需要使用&#34; file:/// [TARGETDIR] ExcelAddIn.vsto | vstolocal&#34;: