我在 Visual Studio 2010 中使用 WiX 3.5.1930,目标是 .NET Framework 3.5。(就其自定义操作模板而言,最近每周构建的 WiX 似乎非常糟糕,至少目前如此。1930 是最近的构建,它似乎使可构建的 C# CA 具有工作参考。)
我有两个用 C# 编写的自定义操作程序集。其中一个工作正常。另一个失败并出现以下错误:
CustomActionnNameHere returned actual error code 1154 (note this may not be 100% accurate if translation happened inside sandbox)
我已经比较了 .csproj 文件和 .wixproj 文件,并且尽我所能判断差异是否合适(例如包含的 .cs 文件列表)。我已将非工作 .wxs 更改为调用工作自定义操作而不是非工作自定义操作,并且它的工作方式与预期一样。
我还能看到什么来让这个工作?
编辑:为了完整起见,1154 指的是无效的 DLL - net helpmsg 将其(英文)翻译为“运行此应用程序所需的库文件之一已损坏”。
第二次编辑:对 dll 运行 peverify(在安装程序运行时从 \windows\installer 中获取了一个副本),它说 dll 中的一切都很好。DLL 仅具有“返回成功”的自定义操作方法,因此没有太多需要验证的内容,但它确实确认 DLL 没有损坏。
第三次编辑:损坏的自定义操作中的代码如下:
using Microsoft.Deployment.WindowsInstaller;
namespace Framework.Installer.Database {
public class CustomActions {
[CustomAction]
public static ActionResult RunMigration(Session session) {
return ActionResult.Success;
}
}
}
没什么。.wxs的相关部分如下:
<InstallExecuteSequence>
<Custom Action="DotNetMigratorCustomActionPreviousUp" After="SetMigrationPropertiesPreviousUp"><![CDATA[(&Database = 3)]]></Custom>
</InstallExecuteSequence>
<Binary Id="DotNetMigratorCustomActionDll"
SourceFile="$(var.Framework.Installer.Database.CustomActions.TargetDir)\SoftwareAnswers.Framework.Installer.Database.CustomActions.dll" />
<CustomAction Id="DotNetMigratorCustomActionPreviousUp"
Return="check"
BinaryKey="DotNetMigratorCustomActionDll"
DllEntry="RunMigration"
Execute="deferred" />