bmt22033
bmt22033

Reputation: 7250

Creating folders in a Visual Studio Installer Setup project

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?

Upvotes: 5

Views: 10433

Answers (3)

StuartV
StuartV

Reputation: 107

On your Special Folder, you can set the DefaultLocation to [CommonAppDataFolder].

On XP, this will resolve to c:\documents and settings\all users\application data

And on Win 7, this will resolve to c:\ProgramData

Upvotes: 0

bmt22033
bmt22033

Reputation: 7250

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".

Upvotes: 3

Cosmin
Cosmin

Reputation: 21436

This is not supported by Visual Studio setup projects.

Other setup authoring tools support this through a type 51 custom action (property set with formatted text).

Basically, your default TARGETDIR can point to one location and a type 51 custom action can change it to another location during install. This custom action can be conditioned with VersionNT property.

Upvotes: 4

Related Questions