我们使用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)
发布于 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
发布于 2010-07-22 10:26:21
存在一个漏洞,可调整清单中的DTF supportedRuntime元素以支持NETFX4.0。这个bug还没有修复,所以你仍然需要自己来做。
发布于 2010-08-04 16:55:50
此外,对于来自Ngm的解决方案,我们必须将托管自定义操作类库的目标框架设置回.NET 2.0以使其正常工作。
https://stackoverflow.com/questions/3298304
复制相似问题