0

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.

3
Contributors
3
Replies
5
Views
7 Years
Discussion Span
Last Post by serkan sendur
Featured Replies
  • You can get this information from Installer.Context Property. Check this link: [url]http://live.mscommunity.net/blogs/notequ/archive/2008/06/05/installer-class.aspx[/url] Read More

0

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

This question has already been answered. Start a new discussion instead.
Take the time to help us to help you. Please be thoughtful and detailed and be sure to adhere to our posting rules.