内置用于.NET Framework 4.0维克斯自定义操作不起作用?方法来解决? [英] WIX Custom Actions built for .Net Framework 4.0 does not work? Ways to resolve?

查看:141
本文介绍了内置用于.NET Framework 4.0维克斯自定义操作不起作用?方法来解决?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用WIX 3.5(内部版本号1811),并内置使用Visual Studio 2008和目标框架NET 3.5的内置自定义操作。这用来工作的伟大,直到我们使用Visual Studio 2010和目标框架.NET 4.0中内置的自定义操作。

维克斯无法调用自定义操作,我们得到的错误是这样的:

  SFXCA:提取自定义操作来临时目录:C:\ WINDOWS \ Installer程序\ MSI69BD.tmp- \
    SFXCA:绑定到CLR版本V2.0.50727
    调用自定义操作SomeCompany.SomeProduct.InstallerPlugin!SomeCompany.SomeProduct.InstallerPlugin.XYZProductCustomAction.ABCMethod
    错误:未能从程序集加载自定义动作类SomeCompany.SomeProduct.InstallerPlugin.XYZProductCustomAction:SomeCompany.SomeProduct.InstallerPlugin

    System.BadImageFormatException:未能加载文件或程序集SomeCompany.SomeProduct.InstallerPlugin或它的某一个依赖。这个组件由一运行时间比当前加载运行时更新的构建并不能装载。

    文件名:SomeCompany.SomeProduct.InstallerPlugin
       在System.Reflection.Assembly._nLoad(的AssemblyName文件名,字符串codeBase的,证据assemblySecurity,大会locationHint,StackCrawlMark和放大器; stackMark,布尔throwOnFileNotFound,布尔forIntrospection)
       在System.Reflection.Assembly.nLoad(的AssemblyName文件名,字符串codeBase的,证据assemblySecurity,大会locationHint,StackCrawlMark和放大器; stackMark,布尔throwOnFileNotFound,布尔forIntrospection)
       在System.Reflection.Assembly.InternalLoad(的AssemblyName assemblyRef,证据assemblySecurity,StackCrawlMark和放大器; stackMark,布尔forIntrospection)
       在System.Reflection.Assembly.InternalLoad(字符串assemblyString,证据assemblySecurity,StackCrawlMark和放大器; stackMark,布尔forIntrospection)
       在System.AppDomain.Load(字符串assemblyString)
       在Microsoft.Deployment.WindowsInstaller.CustomActionProxy.GetCustomActionMethod(会话的会话,字符串的AssemblyName,类名字符串,字符串方法名)
 

解决方案

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

  useLegacyV2RuntimeActivati​​onPolicy =真
和
有指定的两个版本:
< supportedRuntime版本=V2.0.50727/>
和
< supportedRuntime版本=V4.0/>
 

如果只是&LT; supportedRuntime版本=V4.0/&GT; 被指定,它不工作所以看起来像维克斯3.5测试版<一个错误。 / P>

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 is unable to invoke the custom action, the error that we get is this:

  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)

解决方案

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"/>

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维克斯自定义操作不起作用?方法来解决?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆