Make a VS.NET setup project save the installation path into the registry

Posted on 2004-10-28
Last Modified: 2011-04-14

I wrote an application using VS.NET 2003 C#. To deploy it I'm using the tool which comes with the VS.NET (by adding a Setup and Deployment Project).

I need my application to know what is the installation folder the user has choosen at the setup procedure, and I guess the registry will do the job. The problem is that I don't know how to make the setup project save that path into the registry.

Is it possible..? (I know other tools like InstallShield is able to do that using parameters)
How it is done using VS.NET?

Thanks for your help.
Question by:ben-gur
    LVL 8

    Accepted Solution

    I'm not sure how you make the setup program do that, but I'm also not sure why you would need it in the registry. Just pull the application path from the executable at first launch, like this:

      Dim aPath As String = Application.ExecutablePath()

    or this would do the same thing without the executable name attached:

    Dim aPath As String = Application.StartupPath()

    So in your Form_Load, call the above, then save it to registry for future use if you need it.
    LVL 4

    Author Comment

    Thank you for your reply. I was not aware of this option, and I've implemeted it in my code.

    I needed it to to be able to access my data files, no matter where from the user executes the application. But due to the lack of functionality (as far as I know..) in VS.NET I had to change my app.

    Thank you very much for you help, please accept the points.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: JavaScript Coding - Massive 12-Part Bundle

    Regardless of your programming skill level, you'll go from basics to advanced concepts in a vast array of JavaScript subjects including Sammy.js, Agility.js, Ember.js, Node.js, jQuery, AJAX, Extjs, AngularJS, Knockout.js, and JSON.

    In my previous article ( we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    This video Micro Tutorial is the first in a two-part series that shows how to create and use custom scanning profiles in Nuance's PaperPort 14.5 ( But the ability to create custom scanning profiles al…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    934 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now