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 自定义操作不起作用?解决方法?


- C# 中多线程网络服务器的模式 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- 输入按键事件处理程序 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01