【问题标题】:Wix setup failing with error 1603Wix 设置失败并出现错误 1603
【发布时间】:2014-09-18 21:41:19
【问题描述】:

我编写了一个 .NET 4 桌面应用程序,在尝试运行 Setup.exe 时,我在日志文件中收到以下错误。

我正在使用带有 Wix 3.7 的 Visual Studio 2012。

MSI (s) (E8:1C) [16:51:54:890]: Invoking remote custom action. DLL: C:\windows\Installer\MSIFECD.tmp, Entrypoint: EncryptConfig SFXCA: Extracting custom action to temporary directory: C:\windows\Installer\MSIFECD.tmp-\ SFXCA: Binding to CLR version v4.0.30319 Calling custom action SecureConfig!SecureConfig.CustomActions.EncryptConfig EncryptConfig: Begin An error occurred creating the configuration section handler for security: Could not load file or assembly 'Order.Configuration.Net' or one of its dependencies. The system cannot find the file specified. (C:\Program Files (x86)\Orbit Order System\Orbit Order System.exe.config line 6) CustomAction EncryptConfigurationFile returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox) Action ended 16:51:55: InstallFinalize. Return value 3.

我可以确认 `Order.Configuration.Net.dll' 和应用程序配置文件一样存在于目标文件夹中。

这是 app.config 文件:

<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="backup" 
             type="OrderConfiguration.BackupConfig, Order.Configuration.Net"/>
    <section name="general" 
             type="OrderConfiguration.GeneralConfig, Order.Configuration.Net"/>
    <section name="security" 
             type="OrderConfiguration.SecurityConfig, Order.Configuration.Net"/> 
          <-- ** THIS IS LINE 6 **
  </configSections>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
  </startup>
  <backup configSource="config\backup.config"/>
  <general configSource="config\general.config"/>
  <security configSource="config\security.config"/>
  <connectionStrings>
    <clear/>
    <add name="OrderDb" 
         connectionString="Data Source=(local);Initial Catalog=OrbitOrder;
         User Id=User;Password=Pass;MultipleActiveResultSets=true;"/>
  </connectionStrings>
</configuration>

我还确认config\security.config 存在于目标文件夹中。

我花了三个小时试图弄清楚错误的含义,因为所有文件都实际存在于目标文件夹中。实际上,我从一年前研究的先前解决方案中复制了 WIX 设置,并且该解决方案运行良好,没有任何问题。

失败的自定义操作正在尝试加密security 配置部分。

我无法解释为什么 MSI 在似乎没有任何问题的情况下会抛出 1603 错误。

【问题讨论】:

  • 可能您尝试加载的文件名有错误,或者该文件正在使用中而您无法锁定它,或者该文件甚至可能不存在于磁盘上但这取决于您如何使用自己的自定义操作对事物进行排序。另外,您是否在 GAC 中安装了一些东西?
  • 我使用完全相同的代码创建了一个测试项目,但仍然出现同样的错误。当我将Order.Configuration.Net.dll 复制到测试程序的bin 文件夹时,它起作用了。我发现这很奇怪,因为我去年为一个类似的程序编写了一个 Wix 设置,它运行良好。对于这个新项目,我使用了相同的设置代码,只是去掉了我不需要的部分。

标签: encryption wix windows-installer app-config


【解决方案1】:

在将以下代码添加到 Wix 自定义操作后,我设法解决了这个问题:

AppDomain.CurrentDomain.AssemblyResolve += ( sender, args ) =>
{
    return Assembly.LoadFrom( string.Format( @"{0}Order.Configuration.Net.dll", installFolder ) );
};

这基本上是说在遇到需要解析的引用时加载程序集。

【讨论】:

    【解决方案2】:

    根据日志,错误是你写的自定义动作返回的,所以请在安装过程中调试自定义动作dll。调试自定义操作的最简单方法是在代码中添加一个消息框(自定义操作的开始),并在显示消息框时附加到 Visual Studio 中的进程。另一种方法是使用 http://msdn.microsoft.com/en-us/library/aa368264%28v=vs.85%29.aspx 中所述的 MsiBreak 环境变量

    【讨论】:

    • 我已尝试使用消息框进行附加处理,但我的断点未命中,并且我在 VS IDE 中收到一条消息,提示“未加载任何符号”。我已将 PDB 与 msiexec.pdb 文件放在同一位置,但不幸的是,我使用的方法是使用 WixCATargetsPath 创建自定义操作 xxxx.CA.dll,这不会创建 PDB 文件。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-24
    • 2012-09-24
    • 1970-01-01
    • 2019-04-06
    • 1970-01-01
    • 2013-07-18
    相关资源
    最近更新 更多