[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework

User settings two different folders for MyApp ClickOnce and .exe

Tomek

8/22/2008 6:05:00 PM

Hi,
I have MyApplication published through ClickOnce.
MyApplication has 2 functionalities: can be restarted if user chooses so,
and user can save one custom user setting, i.e. his/her name.

User installs MyApplication from the ClickOnce location. Then runs it using
MyApplication ClickOnce application reference. User types in his name and
clicks "Save". Then user clicks "Restart".

Now, here comes the twist. In MyApplication I perform the restart by using:
Process.Start(<relative .exe file path>, <parameter>);
and so, notice that it is not relaunched by using the ClickOnce app
reference, but I do it purposefuly because I want to be able to pass in a
parameter on the restart.

So, now I have MyApplication restarted, however I notice that the name (that
user has just typed in and saved) appears to not have been saved. Why? it
turns out that user settings are saved in two different locations: for
MyApplication run through ClickOnce app reference, and when it is run by
directly calling .exe file.

Can I make ClickOnce to somehow use the same location for user settings as
..exe file? Or vice versa?
Has anyone run into this problem? Any solutions?

Thanks,
--Tomek
1 Answer

RobinS

8/27/2008 5:44:00 AM

0

If you don't run it as a ClickOnce application, it's not going to treat it
as one.

About the only thing you can do is create a file to store your one setting
in and put it somewhere else. That would be LocalApplicationData or
MyDocuments.

Environment.SpecialFolder.LocalApplicationData is the recommended place for
saving application data for a user in Windows Vista. I created a folder
there with my app name, and store my configuration information there. Then
you can get to it from any application if you need to.

By the way, why not do the restart by calling
System.Windows.Forms.Application.Restart?

RobinS.
GoldMail.com
=============
"Tomek" <Tomek@discussions.microsoft.com> wrote in message
news:C69AE199-10C7-42F1-BF99-A14191AEEAE9@microsoft.com...
> Hi,
> I have MyApplication published through ClickOnce.
> MyApplication has 2 functionalities: can be restarted if user chooses so,
> and user can save one custom user setting, i.e. his/her name.
>
> User installs MyApplication from the ClickOnce location. Then runs it
> using
> MyApplication ClickOnce application reference. User types in his name and
> clicks "Save". Then user clicks "Restart".
>
> Now, here comes the twist. In MyApplication I perform the restart by
> using:
> Process.Start(<relative .exe file path>, <parameter>);
> and so, notice that it is not relaunched by using the ClickOnce app
> reference, but I do it purposefuly because I want to be able to pass in a
> parameter on the restart.
>
> So, now I have MyApplication restarted, however I notice that the name
> (that
> user has just typed in and saved) appears to not have been saved. Why? it
> turns out that user settings are saved in two different locations: for
> MyApplication run through ClickOnce app reference, and when it is run by
> directly calling .exe file.
>
> Can I make ClickOnce to somehow use the same location for user settings as
> .exe file? Or vice versa?
> Has anyone run into this problem? Any solutions?
>
> Thanks,
> --Tomek