I am developing my first custom action, but I cannot load the resulting .CA.dll file. This is the simplest process, and the result:
I create a custom action project and keep all the defaults. The class is as follows:
using Microsoft.Deployment.WindowsInstaller;
namespace CustomAction
{
public class CustomActions
{
[CustomAction]
public static ActionResult CustomAction1(Session session)
{
session.Log("Begin CustomAction1");
return ActionResult.Success;
}
}
}
Then I create an assembly (either in debugging or in release) that creates the CustomAction.CA.dll file for me. Then I will try to run this test:
[TestMethod]
public void LoadAssembly()
{
Assembly.LoadFrom(@"D:\CustomAction\bin\Debug\CustomAction.CA.dll");
}
And you get an error: System.BadImageFormatException: Failed to load the file or assembly file: /// D: \ CustomAction \ bin \ Debug \ CustomAction.CA.dll or one of its dependencies. The module is expected to contain an assembly manifest.
I also cannot reference a custom action from my WiX project. Awesome!
:
, VS, :
TmiDataManager.TryConvertPropertyValueToDisplayText: , . System.FormatException: .
System.Number.StringToNumber( String str, NumberStyles, NumberBuffer & number, NumberFormatInfo info, Boolean parseDecimal)
System.Number.ParseInt32 (String s, NumberStyles style, NumberFormatInfo info)
System.String.System.IConvertible.ToInt32 ( IFormatProvider)
System.Convert.DefaultToType( IConvertible, targetType, IFormatProvider)
System.String.System.IConvertible.ToType( , IFormatProvider)
System.ComponentModel.EnumConverter.ConvertTo(ITypeDescriptorContext , CultureInfo, , destinationType)
System.ComponentModel.TypeConverter.ConvertToString( ) "
: CustomAction.dll Assembly.LoadFrom, , , BadImageFormat? - , - WiX?