Reputation: 159
We have some special requirements:
Is there any way for the main app to know the location of ClickOnce installation folder?
Thanks, yyff
Upvotes: 5
Views: 2051
Reputation: 11877
You can do this by examining the executing assembly and retrieving the location.
System.Reflection.Assembly assm = System.Reflection.Assembly.GetExecutingAssembly();
This is the location of your ClickOnce deployment. --> assm.CodeBase
Upvotes: 4
Reputation: 273244
Assuming the Click1 app is yours, you could save to some more accesible location. Normally you can write to User\Documents for example.
Upvotes: 2
Reputation: 754725
Try the following
using System.Deployment.Application;
...
var dep = ApplicationDeployment.CurrentDeployment;
var path = dep.DataDirectory;
It may not be in the DataDirectory path but one of those properties is almost ceratinly what you are looking for.
Upvotes: 3