|
-
Mar 16th, 2011, 06:19 AM
#1
Thread Starter
Hyperactive Member
How to find installation directory of other application installed
Hi All,
I have started working on the module based application (plugin based architecture) and client want setup of module that can be run later and added automatically in main application. So, what I am thinking to apply in module setup project is to find the installation directory of main application and then paste dll of module in specific sub-directory.
Is it possible? Is there any other way to add feature in main application later using setup?
Any help is highly appreciated.
Application target framework is 3.5 and I am using VS 2010.
I am using .NET 2010 with Windows 7
-
Mar 16th, 2011, 07:46 AM
#2
Re: How to find installation directory of other application installed
 Originally Posted by Coool
Is it possible? Is there any other way to add feature in main application later using setup?
Can you explain this? You can always re-compile your application to add features. But I suspect you mean something else that I can not understand from your description.
VB6 Library
If I helped you then please help me and rate my post!
If you solved your problem, then please mark the post resolved
-
Mar 16th, 2011, 08:20 AM
#3
Lively Member
Re: How to find installation directory of other application installed
Forgive me if I am off the mark, but what I think the OP is asking is "How do I create a framework to use plugins with my application?" This is something I looked into a while back but never actually implemented, so my personal experience is limited.
This google search:
http://www.google.com/#hl=en&sugexp=...932a0a20b4be5b
Yielded the following top 3 results which should help get you started:
http://geekswithblogs.net/***Next/ar...in-vb.net.aspx
http://vbnotebookfor.net/2007/10/09/...-ins-in-vbnet/
http://www.developerfusion.com/artic...-applications/
Sorry that I don't have much personal experience to share on this matter. I am not one who believes in merely posting links to google searches. I believe in giving people the benefit of the doubt that they have tried searching, and either don't know some of the terms they need to be searching for, or require a more basic explanation than the search results have yielded.
So, personally, off the top of my head, the most common method for implementing plugins requires you to create a standard Interface for your plugin system and to use Reflection to actually use the plugins. "Interfaces" are not something that I have completely wrapped my head around as of yet, and reflection is an "interesting beast" from a beginner's perspective.
Hopefully, this can help lead you in the direction you want to go.
Good luck.
-
Mar 16th, 2011, 08:23 AM
#4
Thread Starter
Hyperactive Member
Re: How to find installation directory of other application installed
Ok let me explain in details.
I am creating plugin based application which detects dll located at installation directory and add menu(which open form from dll) in main application accordingly. So, to add new menu(feature) in main application I just need to include ddls at installation directory of main application and system will detect those features automatically.
Now, client currently want setup of main application and then want another setup(s) for each feature(addon) that add dll to installation directory of main application.
I hope this would help.
I am using .NET 2010 with Windows 7
-
Mar 16th, 2011, 08:37 AM
#5
Re: How to find installation directory of other application installed
@woldpack you were right.
@Coool, so a setup would just copy the files over to the correct directory?
If that is the case, then you either have to force the user to use a specific directory OR store the directory that they choose somewhere, the registry is a good choice.
VB6 Library
If I helped you then please help me and rate my post!
If you solved your problem, then please mark the post resolved
-
Mar 16th, 2011, 09:15 AM
#6
Thread Starter
Hyperactive Member
Re: How to find installation directory of other application installed
@MarMan,
Oh.. How stupid I am not to think of using registry. Thank you very much. I will get back if I find any issue or want any suggestion.
I am using .NET 2010 with Windows 7
-
Mar 16th, 2011, 09:22 AM
#7
Lively Member
Re: How to find installation directory of other application installed
Coool, if I understand your second question, you want to have a way to get the location of a specific application. This may require use of the Windows API as I am not sure that there are native methods to retrieve a list of installed programs in .NET. This will almost certainly require using the registry. If you know that your program registers certain file types with the application, you might look there in the registry and get the path to the registered EXE for the file type. However, users can remove an association between a program and file type.
This depends on the method of the install program as well, as I would imagine that the install program affects how the program is registered with the system. Most install programs will add the application to the add/remove programs list in Windows. Obviously, Add/Remove programs gets it's information from somewhere, which is where the API calls come in.
It may also be possible, depending again on the installer used, to configure the installer to install addons to an existing program installation, similar to a "patch".
Finally, the laymens way to achieve what you want to do is to parse the system looking for a specific file. You might be able to use the Windows Search API to get the advantages of the Search Index, but it's not likely that the user's Program Files are indexed. This could cause a huge delay whenever the user wants to install a patch, as the installer parses the user's file system to find the application. You could greatly reduce this delay by searching in the most likely locations first. Look at the "GetFolderPath" method (http://msdn.microsoft.com/en-us/libr...olderpath.aspx) to assist you here. This will probably work for the 99% of users who install applications to their default location. Those who "go off the reservation" as it were by choosing a non-standard install path will pay a penalty when installing plugins, but at as a last resort, this method will work.
There is one more method that you could use, as MarMan explained. If you don't already store some sort of setting in the registry that specifies the location of the original program, you can modify the original program to store this information for use by the plugin installer. I don't think this will be a big problem, as it sounds like you already have to update the program to handle the plugins in the first place. Part of the requirement for this update should be placing a key in the registry to let the Plugin installer know where the plugins should be stored. Of course, this would mean that installers for your plugin will need to be written by you. However, this could be made easier by creating a simple .exe that you can zip into a self extracting EXE that runs the "simple.exe" program. "Simple.exe" would scan the registry and move the .dll to the plugin folder. Win-RAR is a good choice that comes to mind. For the $29 registration fee, you are legally able to distribute as many self-extracting EXE files as you want for any reason, and I have found the EXE options to be pretty robust.
There are many many ways to do what you are asking. It just depends how easy or difficult you want to make it for you and your users. I'm not sure this is a question we can answer for you, but I have outlined several possible solutions you could employ.
-
Mar 20th, 2011, 11:19 PM
#8
Thread Starter
Hyperactive Member
Re: How to find installation directory of other application installed
Ok, I have created setup project that add installation directory location in registry but now I'm stuck in creating setup project of plugin module that automatically deploy dll in main application folder WITHOUT PROMPT. Can anyone put me in right direction for this?
I am using .NET 2010 with Windows 7
-
Mar 20th, 2011, 11:23 PM
#9
Re: How to find installation directory of other application installed
You can use a Custom Action in your Setup project to read the path from the Registry and then assign this to the [TARGETDIR] parameter of your installer. Adding the Custom Action and reading the data is easy enough but I don't know how to do the rest offhand as it's some time since I worked with a Setup project. If you search the web for working with [TARGETDIR] though, I'm sure that you can find examples.
-
Mar 21st, 2011, 01:44 AM
#10
Thread Starter
Hyperactive Member
Re: How to find installation directory of other application installed
Thanks jmcilhinney. I would try your suggestion and reply if I find any problem. :-)
I am using .NET 2010 with Windows 7
-
Mar 21st, 2011, 10:55 AM
#11
Thread Starter
Hyperactive Member
Re: How to find installation directory of other application installed
No, it's not working! :-(
After spending some time on internet I also found that TARGETDIR cannot be changed using installer class.
http://www.dotnetmonster.com/Uwe/For...nstaller-Class
However, I succeeded to search for the registry value in Launch Conditions, so now plugin installer only launch if main product is installed.
But again even if I change TARGETDIR value of Application Folder, how can I stop installer asking for target directory? I want installer smart enough to find target directory without asking for the location.
I am using .NET 2010 with Windows 7
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|