2

I have an application deployed via ClickOnce, along with a separate .NET console application that needs access to the ClickOnce application's installation directory. By the application's installation directory, I mean:

"C:\Documents and Settings\[username]\Local Settings\Apps\2.0\[obfuscated folder]\[obfuscated folder]\[obfuscated folder]\application.exe"

, or on Windows 7:

"C:\Users\[username]\AppData\Local\Apps\2.0\[obfuscated folder]\[obfuscated folder]\[obfuscated folder]\application.exe"

Is there any way for me to generate, or preferably determine at build time, what the obfuscated folder names will be for my application?

Basically, I would like for the console application, which is built and distributed with each release of the application, to know the directory structure under which the application will be installed.

I know that I can determine this location from within the ClickOnce application using "Application.ExecutablePath", and then save the value to a known location, but I would much rather be able to predict the application's installation path in advance...

Any ideas?

Osbourne Ruddock
  • 465
  • 4
  • 20

1 Answers1

0

I don't think its possible to know that path in advance. It can also change when you update the version of an app too.

Do you want to know the path so that the two apps can find each other? If so you could use a simple IP listener in one app and connect to it from the other one. You can just connect on 127.0.0.1 and then ask the other app the path.

Greg Jackman
  • 686
  • 7
  • 9
  • I am aware that the path changes with every update of the main application, and I am currently distributing the console application with my main application via ClickOnce, so I am already distributing an updated console application with every application update. The console application works with the main application's assemblies and some aspects of its configuration, and there should be no reason to assume that the two applications will be running contemporaneously. I don't imagine I can rely on the mechanism you're describing since that's the case. Thanks for the suggestion, though. – Osbourne Ruddock Apr 23 '11 at 23:17