使用 Wix 安装程序安装后无法读取配置文件
Trouble reading from the configuration file after installing it with Wix installer
在我的 Excel 加载项项目中,我正在从 app.config 文件(重命名为 iFMExcelAddIn.dll.config)中读取一些数据,但是在通过 Wix 安装时,我的加载项没有从配置文件中读取数据,即使我也在使用安装程序安装配置文件。我不知道我在这里错过了什么。我没有太多使用 Wix Installer 的经验,而且所有的谷歌搜索都没有给出丰硕的结果。
我想这与我安装配置的方式有关 file.The 以下是我用来添加配置文件的代码。它是组件组中的最后一个第二个组件。
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>
经过将近两天的搜索和了解 app.config 的工作原理后,我找到了解决此问题的方法。实际上,在部署 excel 加载项后,我发现它试图从路径 ---> Install Drive>:\Program Files\Microsoft Office\Office12\EXCEL.EXE.config
读取 app.config 文件。我什至想过将我的配置条目放入 excel.exe.config 文件中以使其工作,但由于这不是正确的方法,我发现我们需要更改指定 vsto 插件路径的注册表条目。这个变化看起来很愚蠢
清单注册表条目需要以 file:///.ie 为前缀,而不是“[TARGETDIR]ExcelAddIn.vsto|vstolocal”:我们需要使用 "file:///[TARGETDIR]ExcelAddIn.vsto|vstolocal":
在我的 Excel 加载项项目中,我正在从 app.config 文件(重命名为 iFMExcelAddIn.dll.config)中读取一些数据,但是在通过 Wix 安装时,我的加载项没有从配置文件中读取数据,即使我也在使用安装程序安装配置文件。我不知道我在这里错过了什么。我没有太多使用 Wix Installer 的经验,而且所有的谷歌搜索都没有给出丰硕的结果。
我想这与我安装配置的方式有关 file.The 以下是我用来添加配置文件的代码。它是组件组中的最后一个第二个组件。 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>
经过将近两天的搜索和了解 app.config 的工作原理后,我找到了解决此问题的方法。实际上,在部署 excel 加载项后,我发现它试图从路径 ---> Install Drive>:\Program Files\Microsoft Office\Office12\EXCEL.EXE.config
读取 app.config 文件。我什至想过将我的配置条目放入 excel.exe.config 文件中以使其工作,但由于这不是正确的方法,我发现我们需要更改指定 vsto 插件路径的注册表条目。这个变化看起来很愚蠢
清单注册表条目需要以 file:///.ie 为前缀,而不是“[TARGETDIR]ExcelAddIn.vsto|vstolocal”:我们需要使用 "file:///[TARGETDIR]ExcelAddIn.vsto|vstolocal":