0

My application is distributed via ClickOnce. When I run it via mouse double click, user.config file is placed in: C:\Users\[CurrentUser]\AppData\Local\Apps\2.0\Data\P0WQRYN8.PBV\4321W00T.92K\my..app_eb3f5973611fd9b4_000c.0002_56b6f2889f1bcbd8\Data\1.1.4437.29060\user.config

but when it application starts via Process.Start(Application.ResourceAssembly.Location);, user.config file is placed in: C:\Users\[CurrentUser]\AppData\Local\\MyApp.exe_Url_wrn00nujc5xzzcvuijpa4djtekw1ss32\1.1.4437.29060\user.config

How can I avoid this behavior when I run application via start process?

Rover
  • 2,203
  • 3
  • 24
  • 44
  • May I ask why is important where this file is placed? Usually you should read/write to it using the framework. By the way, 'C:\users\appdata' doesn't exist! – Steve Feb 24 '12 at 13:46
  • @Steve, this path exists in Windows 7 (with added current user). I don't care where this file, but it's important to load settings. When I load app via Process.Start it doesn't apply settings, instead it saves settings to another location. – Rover Feb 24 '12 at 14:05
  • @micah-armantrout I don't want to change location, I want to use one user.config file for one application. – Rover Feb 24 '12 at 14:10
  • ok maybe its not a dup but that can still help solve your problem – Micah Armantrout Feb 24 '12 at 14:16

1 Answers1

0

Use ApplicationDeployment.CurrentDeployment.UpdateLocation instead of Application.ResourceAssembly.Location.

Rover
  • 2,203
  • 3
  • 24
  • 44