AutomaticUpdater wyUpdate Command Line Code Behind

It seems that if I set the AutomaticUpdater's wyUpdateCommandline property (the -basedir option, in particular) during design time - in XAML - things seem to run okay.

If I try setting it right after InitializeComponent is called (for my window), then setting the property seems to have no effect.

As a test, I tried setting a registry value with the "%basedir%" variable in wybuild.

If I set -basedir in XAML like this:<wy:AutomaticUpdater Name="autoUpdater" wyUpdateCommandline='-basedir="C:\Path\to\Dir\"' />The registry value gets C:\Path\to\Dir\ and the updates go to the proper location.

If I set it in code like this:InitializeComponent;string arg = "-basedir=\"" + "C:\\Path\\to\\Dir\\" + "\"";autoUpdater.wyUpdateCommandline = arg;

Then the registry value is just the current directory, not the one that I set it to.

I'm also unable to set a binding in XAML between it and the argument that I want to set it to, because it's not a dependency property.

I'd like to do this in the code-behind, because I don't know the absolute path to the directory that I want to set the -basedir option to.

Any suggestions on how to solve this?

I think I've got a quick workaround for this:XAML:<wy:AutomaticUpdater Name="autoUpdater" wyUpdateCommandline="{StaticResource myKey}"/>

C#argument = "-basedir=\"C:\\Path\\To\\\"";this.Resources.Add("myKey", argument);InitializeComponent();

You'll get a designer error message, but it still gets the value.

This really only works if you can do everything before any components are initialized.

If I try setting it right after InitializeComponent is called (for my window), then setting the property seems to have no effect.

This is absolutely right, and by design. wyUpdate is started early on in the life of an app (especially is something needs to get done -- like checking for updates). The commandline arguments only have an effect before wyUpdate is started (obviously).

So set the arguments in the constructor of your Window / Form.

Right, but it looks like it's being initialized by InitializeComponent (the autoupdater initializes its own values on the EndInit event).

This seems to form a sort of Catch-22: I'd like to give the AutomaticUpdater some values prior to InitializeComponent (where the wyupdate stuff seems to begin), but the AutomaticUpdater object isn't instantiated until InitializeComponent is called, since it was declared in XAML.

Any attempt at setting a property before InitializeComponent will result in a null reference exception.