By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,369 Members | 950 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,369 IT Pros & Developers. It's quick & easy.

How to change defaultLocation based on the OS

P: 14
I have a windows application using .net 1.1

In the setup project I set the DefaultLocation to

Is there a way to change this defaultLocation based on the OS.
I'd like to leave this location when installing on Windows XP but change the location to another path when installing on Windows Vista.

Can I use an If-statement to determine the OS and then set the DefaultLocation?
Dec 30 '08 #1
Share this Question
Share on Google+
8 Replies

Expert 100+
P: 807
@David R
Yes, just look at Environment.OSVersion and set Environment.CurrentDirectory

HTH --Sam
Dec 30 '08 #2

P: 14
I guess I don't know where to do this
Dec 30 '08 #3

Expert 100+
P: 807
What language are you using (C# or VB)? What sort of app (Windows or ASP)? In any case, you'll want to put it first thing: probably in the form load event, assuming that you have a form.
Dec 30 '08 #4

P: 14
Its a Windows app, C#. .net 1.1
No, I do not have a form load event
Dec 30 '08 #5

Expert 100+
P: 807
>No, I do not have a form load event
Does your app have a form? If so, just double-click on the form in the designer & you will have the outline for the load event. If not, what code gets executed first? can't you put it there?
Dec 30 '08 #6

P: 14
I guess I'm not understanding.
I have 2 projects in my solution. One is the application itself, the second is the setup project.
In the setup project I setup the application folders to be created during the installation.
A property of the Application Folder is "DefaultLocation" where I have it set to "[ProgramFilesFoler][Manufacturer]\ABC"

How do I change this location based on the OS during setup?
Jan 15 '09 #7

P: 1
David, Did you ever figure out how to do this?
I need to do this as well...change the DefaultLocation during installation based on OS.
Mar 23 '10 #8

Expert 100+
P: 569
Add an Installer Class to your project (not in the setup). In this class, you override the Sub Install. In this class, you change the default installation location. Build your project! Now, in your Setup project, you add a Custom Action to the Install and choose the Primary output of the other project. That should do the trick.

Mar 24 '10 #9

Post your reply

Sign in to post your reply or Sign up for a free account.