This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Custom Action: Managed Code
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 29, 2010
04:00 PM
Custom Action: Managed Code
Is it possible to set up a custom action that calls a managed assembly with a class that has an overridden constructor? It looks like it just assumes a default even if a default doesn't exist. For example:
public class TestClass
{
public TestClass()
{
}
public TestClass(string stringTest, bool boolTest, int iTest)
{
}
public void ShowMessage(string stringMessage)
{
Console.WriteLine("Testing 1...2...3");
}
}
When I create the custom action, I don't see a way to use the overridden ctor. When I remove the default, I still don't see the parameters for the only ctor left.
public class TestClass
{
public TestClass()
{
}
public TestClass(string stringTest, bool boolTest, int iTest)
{
}
public void ShowMessage(string stringMessage)
{
Console.WriteLine("Testing 1...2...3");
}
}
When I create the custom action, I don't see a way to use the overridden ctor. When I remove the default, I still don't see the parameters for the only ctor left.
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 30, 2010
08:12 PM
I would reccomend that you use WiX DTF with InstallShield instead. The custom action will be a static class with a static method:
//Example
[CustomAction]
ActionResult MyCustomAction( Session session )
{
var productName = session["ProductName"];
}
Use this as a adapter for your private class and do whatever intefaces, overloads that you deem needed.
I have lots of examples on my blog.
//Example
[CustomAction]
ActionResult MyCustomAction( Session session )
{
var productName = session["ProductName"];
}
Use this as a adapter for your private class and do whatever intefaces, overloads that you deem needed.
I have lots of examples on my blog.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 12, 2010
04:26 PM
The core of Christopher's recommendation holds with either technology. If you want to use a custom constructor, you must put that code on something that does not require a custom constructor to access. This can be a static method, or a method on a class with a parameterless constructor.
If you want full flexibility, you could theoretically create a static method with parameters for both the constructor and the method it eventually calls into.
If you want full flexibility, you could theoretically create a static method with parameters for both the constructor and the method it eventually calls into.
public static void CTorWrapper(string ctor1, bool ctor2, int ctor3, string meth1)
{
new TestClass(ctor1, ctor2, ctor3).ShowMessage(meth1);
}