How to get the [TargetDir] in which user installed the program?

  • Thread starter Thread starter Shelby
  • Start date Start date
S

Shelby

Hi,

how can I get the [TargetDir] in which I installed the program?
I tried:
- System.Windows.Forms.Application.StartupPath
- System.Environment.CurrentDirectory
both does not return me the path in which I have installed the program.
They return the path of the Outlook Com-Addin.

Shelby
 
Shelby,
Have you looked at the System.Assembly.Location or System.Assembly.CodeBase
properties?

You might need to use System.Assembly.GetExecutingAssembly to get your
com-addin assembly, then use the above.

Hope this helps
Jay
 
Hi Jay,
user can change the installation path when during installation. Will that
work in this case?
Does that method require an Assembly variable in AssemblyInfo.vb? For
example:
<Assembly: AssemblyTitle("")>

Shelby
 
Shelby,
user can change the installation path when during installation. Will that
work in this case?
Did you check help on the properties & methods I mentioned?

http://msdn.microsoft.com/library/d...ystemReflectionAssemblyClassCodeBaseTopic.asp

http://msdn.microsoft.com/library/d...ystemReflectionAssemblyClassLocationTopic.asp

http://msdn.microsoft.com/library/d...ionAssemblyClassGetExecutingAssemblyTopic.asp

They identify from where the assembly is executing from...
Does that method require an Assembly variable in AssemblyInfo.vb? For
example:
<Assembly: AssemblyTitle("")>

How does that story go: Give a man a fish, he eats for a day, teach a man to
fish he eats for live... Thanks for understanding

Hope this helps
Jay
 
Back
Top