“Action start 12:03:53: LoadBCAConfigDefaults. SFXCA:将自定义操作提取到临时目录:C:\ DOCUME〜1 \ ELOY06〜1 \ LOCALS〜1 \ Temp \ MSI10C.tmp-\ SFXCA:绑定到CLR版本v2.0.50727 调用自定义操作WIXCustomActions!WIXCustomActions.CustomActions.LoadBCAConfigDefaults 错误:无法从程序集WIXCustomActions加载自定义操作类WIXCustomActions.CustomActions System.BadImageFormatException:无法加载文件或程序集'WIXCustomActions'或其某个依赖项。该程序集是由比当前加载的运行时更新的运行时构建的,因此无法加载。 文件名:'WIXCustomActions' 在System.Reflection.Assembly._nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,Assembly locationHint,StackCrawlMark& stackMark,Boolean throwOnFileNotFound,Boolean forIntrospection) 在System.Reflection.Assembly.nLoad(AssemblyName fileName,String codeBase,Evidence assemblySecurity,Assembly locationHint,StackCrawlMark& stackMark,Boolean throwOnFileNotFound,Boolean forIntrospection) 在System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,Evidence assemblySecurity,StackCrawlMark& stackMark,Boolean forIntrospection) 在System.Reflection.Assembly.InternalLoad(String assemblyString,Evidence assemblySecurity,StackCrawlMark& stackMark,Boolean forIntrospection) 在System.AppDomain.Load(String assemblyString) 在Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod(Session session,String assemblyName,String className,String methodName)”
上述具体问题是“System.BadImageFormatException:无法加载文件或程序集'WIXCustomActions'或其某个依赖项。该程序集是由比当前加载的运行时更新的运行时构建的,因此无法加载。”
这个错误的措辞似乎表明类似于.NET框架引用不正确之类的问题(我在自定义操作和其依赖项中都针对3.5),但我无法找出在哪里进行更改以解决此问题。有什么想法吗?
...不确定这是否有帮助,但这是我运行的CustomActions软件包批处理文件,用于创建包含自定义操作函数的.dll包:
===============
call“C:\ Program Files \ Microsoft Visual Studio 10.0 \ VC \ vcvarsall.bat”
@echo on
cd“C:\ development \ trunk \ PortalsDev \ csharp \ production \ Installers \ WIX \ customactions \ PAServicesWIXCustomActions”
csc /target:library /r:"C:\program files\windows installer xml v3.6\sdk\microsoft.deployment.windowsinstaller.dll" /r:"C:\development\trunk\PortalsDev\csharp\production\Installers\WIX\customactions\PAServicesWIXCustomActions\bin\Debug\eLoyalty.PortalLib.dll" /out:"C:\development\trunk\PortalsDev\csharp\production\Installers\WIX\customactions\PAServicesWIXCustomActions\bin\Debug\WIXCustomActions.dll" CustomActions.cs
进入目录 "C:\Program Files\Windows Installer XML v3.6\SDK"
运行 makesfxca 命令,生成自解压缩文件 "BatchCustomerAnalysisWIXCustomActionsPackage.dll" ,并将其与 "Microsoft.Deployment.WindowsInstaller.dll" 和 "customaction.config" 一起打包到 "WIXCustomActions.dll" 中,使用的 sfxca.dll 文件路径为 "c:\program files\windows installer xml v3.6\sdk\x86\sfxca.dll"。