WIX Custom Actions built for .Net Framework 4.0 does not work? Ways to resolve?(为 .Net Framework 4.0 构建的 WIX 自定义操作不起作用?解决方法?)
问题描述
我们使用的是 WIX 3.5(内部版本号 1811)并构建了使用 Visual Studio 2008 构建的自定义操作,目标框架为 .Net 3.5.在我们使用 Visual Studio 2010 和目标框架为 .Net 4.0 构建自定义操作之前,这曾经很有效.
We were using WIX 3.5 (Build Number 1811) and built a custom action built using Visual Studio 2008 and with target framework as .Net 3.5. This used to work great, until we built the custom action using Visual Studio 2010 and with target framework as .Net 4.0.
WIX 无法调用自定义操作,我们得到的错误是:
WIX is unable to invoke the custom action, the error that we get is this:
SFXCA: Extracting custom action to temporary directory: C:WindowsInstallerMSI69BD.tmp-
SFXCA: Binding to CLR version v2.0.50727
Calling custom action SomeCompany.SomeProduct.InstallerPlugin!SomeCompany.SomeProduct.InstallerPlugin.XYZProductCustomAction.ABCMethod
Error: could not load custom action class SomeCompany.SomeProduct.InstallerPlugin.XYZProductCustomAction from assembly: SomeCompany.SomeProduct.InstallerPlugin
System.BadImageFormatException: Could not load file or assembly 'SomeCompany.SomeProduct.InstallerPlugin' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
File name: 'SomeCompany.SomeProduct.InstallerPlugin'
at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.AppDomain.Load(String assemblyString)
at Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod(Session session, String assemblyName, String className, String methodName)
推荐答案
好吧,我们终于解决了问题,我们必须设置:
Well we finally resolved the problem, we had to set:
useLegacyV2RuntimeActivationPolicy="true"
and
have both versions specified:
<supportedRuntime version="v2.0.50727"/>
and
<supportedRuntime version="v4.0"/>
如果只指定了 "<supportedRuntime version="v4.0"/>
,则它不起作用.所以看起来像 WIX 3.5 Beta 中的错误
If just "<supportedRuntime version="v4.0"/>
is specified, it does not work. So looks like a bug in WIX 3.5 Beta
这篇关于为 .Net Framework 4.0 构建的 WIX 自定义操作不起作用?解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为 .Net Framework 4.0 构建的 WIX 自定义操作不起作用?解决方法?


基础教程推荐
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 如何激活MC67中的红灯 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01