catsaremyfriends
Posts: 33
Joined: Thu Mar 26, 2009 9:21 pm

Can Formatted Data Types be passed to a .NET custom action?

Is it possible to pass a Formatted Data Type into a .NET custom action written in C#?

For example could I pass [ProductName]?

Thanks,

cats
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Can Formatted Data Types be passed to a .NET custom action?

Hi,

Yes, this can be done by setting the formatted reference as the value of a a installer class parameter. Inside the custom action you can retrieve the formatted reference from the parameter.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
catsaremyfriends
Posts: 33
Joined: Thu Mar 26, 2009 9:21 pm

Re: Can Formatted Data Types be passed to a .NET custom action?

Excellent!

The next question, is how to retrieve the value inside the custom action. For future readers who may read this thread, this is what I did for my C# custom action...

In the AI New Installer Class Parameter dialog I entered the following:

Name: TargetDir
Value: [ProgramFilesFolder][Manufacturer]\[ProductName]

Inside my C# custom action, I retrieved the value using the following code:

string passedValue = this.Context.Parameters("TargetDir");

Thanks Cosmin,

cats

Return to “Common Problems”