Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Fri, 22 Aug 2008 11:04:34 -0700,    group: microsoft.public.dotnet.framework        back       


User settings two different folders for MyApp ClickOnce and .exe   
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
date: Fri, 22 Aug 2008 11:04:34 -0700   author:   Tomek

Re: User settings two different folders for MyApp ClickOnce and .exe   
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"  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
date: Tue, 26 Aug 2008 22:43:36 -0700   author:   RobinS

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us