首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >为.Net Framework4.0构建的WIX自定义操作不起作用?如何解决?

为.Net Framework4.0构建的WIX自定义操作不起作用?如何解决?
EN

Stack Overflow用户
提问于 2010-07-21 18:37:16
回答 4查看 8.7K关注 0票数 16

我们使用Wix3.5(内部版本号1811),并构建了一个使用Visual Studio2008构建的自定义操作,目标框架为.Net 3.5。这曾经非常有效,直到我们使用Visual Studio2010和目标框架.Net 4.0构建了自定义操作。

WIX无法调用自定义操作,我们得到的错误是:

  SFXCA: Extracting custom action to temporary directory: C:\Windows\Installer\MSI69BD.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)
EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2010-08-03 14:33:45

我们最终解决了这个问题,我们必须设置:

useLegacyV2RuntimeActivationPolicy="true"
and
have both versions specified:
<supportedRuntime version="v2.0.50727"/>
and
<supportedRuntime version="v4.0"/>

如果仅指定"<supportedRuntime version="v4.0"/>,则它不起作用。所以看起来像Wix3.5Beta中的一个bug

票数 7
EN

Stack Overflow用户

发布于 2010-07-22 10:26:21

存在一个漏洞,可调整清单中的DTF supportedRuntime元素以支持NETFX4.0。这个bug还没有修复,所以你仍然需要自己来做。

票数 2
EN

Stack Overflow用户

发布于 2010-08-04 16:55:50

此外,对于来自Ngm的解决方案,我们必须将托管自定义操作类库的目标框架设置回.NET 2.0以使其正常工作。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3298304

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档