using Microsoft.Deployment.WindowsInstaller;
namespace CustomAction
{
public class CustomActions
{
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
session.Log("Begin CustomAction1");
return ActionResult.Success;
}
}
}
[TestMethod]
public void LoadAssembly()
{
Assembly.LoadFrom(@"D:\CustomAction\bin\Debug\CustomAction.CA.dll");
}
获取错误: system.badimageFormateXception:无法加载文件或汇编'文件:/// d:\ debug \ debug \ customAction.ca.dll'或其依赖项之一。预计该模块将包含一个装配清单。
我无法从Wix项目中引用自定义操作。真的很沮丧!
Edit: 看了一下,当我通过VS测试管理器运行时,我会在应用程序事件日志中获得以下内容:tmidatamanager.tryconvertpropertyvaluetodisplaytext:无法使用属性描述符类型转换器转换属性值。 System.FormateXception:输入字符串的格式不正确。 在system.number.stringtonumber(字符串str,numberStyles选项,numberBuffer&Numbers,numberFormatinfo信息,布尔式parsedecimal)
at System.Number.ParseInt32(字符串S,numberstyles样式,numbernformatinfo信息)
在System.String.System.Iconvertible.toint32(IformatProvider提供商) 在System.Convert.defaultTotype(Iconvertible值,键入TargetType,IformatProvider提供商)
at System.String.System.Iconvertible.Totype(类型类型,IFORMATPROVIDER提供商)
在System.com.ponentmodel.enumconverter.convertto(ItypedScriptorContext上下文,cultureInfo文化,对象价值,键入目标类型)
在system.com.ponentmodel.typeconverter.convertTostring(对象值)”
FURTHER编辑:我可以通过assembly.dlomfrom加载普通的customAction.dll,所以也许这与BadImageFormat的东西是另一个问题?是否有任何理由没有其他依赖的空白操作不会加载到我的Wix项目中?
customaction.ca.dll是一个本机代码dll,包含托管代码组件,并且知道如何作为MSI内部的自定义操作运行。托管代码组件是“ customAction.dll”。
Https://giorgiogio48.wixsite.com/firebird-vbnet/post/c-vb-net-net-systembadimageformatexceptionxception-problem-solvedIment-