I’ve built a Visual Studio (2010) Installer Setup project to deploy a basic WinForms app and I need my installer to create a couple of directories based on the OS that its running on. For example, when the installer is run on Windows XP (and earlier), I need to create:
Application Folder\NewFolder
If the installer is running on Vista or later, I need to create the directory below the Common Application Data Folder (i.e., C:\ProgramData) like this:
Common Application Data Folder\NewFolder
I see that I can add a “Custom Folder” via View -> “File System” but I’m not sure how to declare the DefaultLocation property for this new folder. It defaults to a value of [TARGETDIR] but I’m uncertain how to specify the location of the directory that I want to create. Can this be done with a Visual Studio Installer Setup project or am I out of luck?
I finally got this working by adding both folder locations to my setup project via View -> File System. Then I specified a Condition for each folder. For the folder I want to create on XP, I used “WindowsBuild < 6000” and for the Vista/Windows 7 folder, I used “WindowsBuild >= 6000”.