简体   繁体   中英

Property from C# installer UI not accessible in Installer class

I'm having a problem with an installer from which I need to take a couple of fields of user input. Say that I have a Textboxes UI dialog in VS, in which I have set the first field's Property name to "URI". All the articles, StackOverflow posts etc that I can find are telling me I should access that value like so:

public override void Install(IDictionary stateSaver)
{
    base.Install(stateSaver);

    string uri = this.Context.Parameters["URI"];

}

but this is not working; all I am getting is an empty string. Why is that? What do I need to do differently?

This was a misconception partly due to examples I read passing the CustomAction Data property using the same name and capitalisation for the UI property name as for the CustomAction name. Specifically, I had interpreted it as meaning if one specified the value of 'Edit1Property' in a Textboxes UI dialog as "URI", the value entered would be passed to Context.Parameters["URI"]. This is missing a step. As per Alex's answer, specifically this article linked in the answer he suggested, one must also add each property that needs to be passed to the CustomActionData field for the Custom Action which uses it.

Thank you Alex.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM