i was able to create a shortcut name dynamically, now i need to link it to executable of my software. to do that i need to know where the software has been installed.

So the question is how to get installation folder in custom installer class?

Thanks.

Recommended Answers

You can get this information from Installer.Context Property.

Check this link:
http://live.mscommunity.net/blogs/notequ/archive/2008/06/05/installer-class.aspx

Jump to Post

All 3 Replies

Hi serkan sendur,

To get only the folder part of the path, use static method GetDirectoryName of Path class.

using System.IO;
using System.Windows.Forms;

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

To get assembly in which the specified class is defined use method Assembly.GetAs­sembly (with the specified class type as a paramater). The assembly must be loaded. Next get assembly file path using Assembly.CodeBase property.

using System.IO;
using System.Reflection;

string path = Path.GetDirectoryName(
                     Assembly.GetAssembly(typeof(MyClass)).CodeBase);

I hope its helps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.