I'm a C# and WiX relative newbie
My goal was to pass three parameters (InputString, SearchString, ReplaceString) in order to transform a path for use in an erlang (erl.ini) file, which requires double backslashes in Windows.
My hope was to be able to access an OutputString to set a property in my WiX project.
Here's my C# customaction code
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Deployment.WindowsInstaller;
namespace DGCustomActions
{
public class CustomActions
{
[CustomAction]
public static ActionResult CASearchAndReplace(Session session)
{
try
{
session.Log("Begin CASearchAndReplace");
string InputString = session.CustomActionData["InputString"];
string SearchString = session.CustomActionData["SearchString"];
string ReplaceString = session.CustomActionData["ReplaceString"];
session["OutputString"] = InputString.Replace(SearchString, ReplaceString);
session.Log("CASearchAndReplace Successful");
}
catch (Exception ex)
{
session.Log("ERROR in custom action CASearchAndReplace: {0}",
ex.ToString());
return ActionResult.Failure;
}
return ActionResult.Success;
}
}
}
Here's my attempt at passing parameters and running the customaction
<CustomAction Id='PassValuesErlangBindir'
Execute='immediate'
Property='TransformErlangBindir'
Value='InputString=[ERLANGERTSBINDIR];SearchString=\;ReplaceString=\\' />
<CustomAction Id='TransformErlangBindir'
BinaryKey='DGCustomActions'
DllEntry='CASearchAndReplace'
Execute='deferred'
Return='check' />
I currently have no code for accessing the OutputString property
Any help would be greatly appreciated