ClickOnce Deployment Location

We have special requirements:

  • In our application, launch the ClickOnce application. It will load the ClickOnce application into the user's cache.
  • After that, the main application should gain access to some file loaded into the ClickOnce application folder.

Is there a way for the main application to find out the location of the ClickOnce installation folder?

Thanks yyff

+4
source share
3 answers

Assuming the Click1 app is yours, you can save it to a more accessible location. You can usually write in User \ Documents, for example.

+2
source

You can do this by examining the execution assembly and retrieving the location.

System.Reflection.Assembly assm = System.Reflection.Assembly.GetExecutingAssembly(); 

This is the location of the ClickOnce deployment. → assm.CodeBase

+4
source

Try to execute

 using System.Deployment.Application; ... var dep = ApplicationDeployment.CurrentDeployment; var path = dep.DataDirectory; 

It may not be the same as in the DataDirectory path, but one of these properties is almost entirely dependent on what you are looking for.

+3
source

All Articles