Accessing file in installation directory in vb.net

2019-09-21 15:42发布

问题:

Thanks ahead of time for your help!

I have an installation project in my solution. The installation project includes files that I would like to include in the install directory (template files, README docs, etc.).

The template file, specifically, I would like to access in my code so that I can open it and populate it with real-time data. At run-time, how can I see where the user installed the application and access that template file?

Using Visual Studio 2010 (full version)

Language: VB.NET

回答1:

Looks like I can find what I need here: getting location of installed application vb.net

This will allow me to get the filepath of the installation directory at least. From there I can open the template since I know the name of the template ahead of time.



回答2:

Your .net software installed in client pc At the time of installation path get and add your images template.doc etc file in resources folder of applications folder and access fileof dynamically in client pc

string path = Path.GetDirectoryName(Application.ExecutablePath);

and get path of installation software after that use resources folder to access it