ProjectInstaller: Get installedfolder and other properties at installation

Hi all,

I've built a Windows Service in VB.NET.
Added a projectinstaller and a setup project which creates the MSI and Setup.exe.
This all works fine.

I want to add a form that can be displayed at the end of installation (OnAfterInstall event) in which the user can do some settings.
In this screen I also want to display the folder that the service is installed to.

I can display the form, that's no problem.
But I can't seem to find the "installation properties" like the installation folder (ie: the folder in which the service is installed).

Any ideas?


Ps: For a complete working example in VB.NET I'll up the points to 500.
LVL 12
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Write the installed folder value to the registry, then read that value when you show the form. If you are using the setup project stuff the TARGETDIR is the keyword for the install directory.
rovermAuthor Commented:
I am using the 'setup project stuff' but I can't seem to access that from my ProjectInstaller.
Also, I don't want to write to the registry.

Thanks tho.

Bob LearnedCommented:
Installer.ProductInfo("{product code guid}","InstallLocation")
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

rovermAuthor Commented:
My installer doesn't provide a 'ProductInfo' prop.

Just to make sure: I am using the ProjectInstaller in my Service Project.
Bob LearnedCommented:
Sorry, all I focused on was the MSI part.  You can get this property from there.  

You are talking about ServiceInstaller, correct?
rovermAuthor Commented:
What do you mean : "MSI part".
Can I access the MSI from the ProjectInstaller?

ProjectInstaller: Right click on 'Service1' (your service in the designer) and choose 'Add Installer'.
Bob LearnedCommented:
No.  I just saw the word MSI in your initial comment, and that is the method within the Windows Installer.  

Now that I understand better, AFAIK there isn't any way to get the Installed location from the Installer class.
Bob LearnedCommented:
Have you looked at the Context property?  It has parameters, and since I haven't used this, I am not quite sure what information it can give you.
rovermAuthor Commented:
It must be possible....
Bob LearnedCommented:
I usually keep this process pretty simple, so I don't have much experience working outside the box on this one.  I am willing, though, to extend a little further outside my "comfort" zone, and help you find this information, because I agree with you that it should be possible.
Bob LearnedCommented:
How is your Install process started?  Are you using InstallUtil?
rovermAuthor Commented:
I've added a setup project to the service project.
The setup creates the MSI and a setup.exe.

The installation will be started by double clicking the msi or the setup.exe.
Bob LearnedCommented:
I always use InstallUtil, so I have to ask, how it the MSI file generated for you?
Bob LearnedCommented:
I figured a little more out here.  You created a Setup and Deployment project.  Doh!!

Is the ProjectInstaller in the Windows Service project?  In the Setup project, what is the value for the 'Application Folder' setting?
rovermAuthor Commented:
Bob LearnedCommented:
In the AfterInstall event there is a sender parameter, which is an IDictionary object for the saved state of the computer.  Did you check the settings from that?

Also there is an article at, which talks about adding additional functionality to the Walkthrough you addressed:

Install a Windows service the way YOU want to!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rovermAuthor Commented:
Closed the Q, was open long enough.... ;-)
Actually it didn't solve my Q but I put me on 'a certain track'. Hopefully I will be able to read it.

rovermAuthor Commented:
Found the solution.... wanna know?
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.