gpt4 book ai didi

.net - 为 .Net Framework 4.0 构建的 WIX 自定义操作不起作用?有什么办法解决?

转载 作者:行者123 更新时间:2023-12-03 02:54:38 30 4
gpt4 key购买 nike

我们使用 WIX 3.5(内部版本号 1811)并构建了一个使用 Visual Studio 2008 构建的自定义操作,目标框架为 .Net 3.5。这曾经非常有效,直到我们使用 Visual Studio 2010 和目标框架 .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)

最佳答案

只是我的两分钱:

与 Ngm 不同,我只需为 .NET 4.0 添加supportedRuntime

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>
</configuration>

重要:

  1. 不要重命名 CustomAction.config
  2. 将 CustomAction.config 构建操作设置为内容,否则它将不起作用

关于.net - 为 .Net Framework 4.0 构建的 WIX 自定义操作不起作用?有什么办法解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3298304/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com