[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 349
  • Last Modified:

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


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.
1 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.
ben-gurAuthor Commented:
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.

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now