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

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

ok this problem is solved, i attach the example project to this post.
i was able to get the installation folder from within the custom installer class.

Be a part of the DaniWeb community

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