开发者

How do can install files via setup project depending on the OS?

开发者 https://www.devze.com 2023-04-01 02:30 出处:网络
The possible OS are Win7 and WinXP each h开发者_运维知识库as its own directory path. Win7 installs in C:\\foo and WinXP installs in D:\\foo. Is this possible using Setup Project?

The possible OS are Win7 and WinXP each h开发者_运维知识库as its own directory path. Win7 installs in C:\foo and WinXP installs in D:\foo. Is this possible using Setup Project?

I'm currently using VS2005.

Thanks in advance.


Firstly, if Windows is installed on C: for Windows 7 and on D: for XP, you can simply set Application Folder default path to:

[WindowsVolume]foo

WindowsVolume property is automatically resolved to the Windows partition.

To change the default Application Folder path you can select it in File System Folder and set DefaultLocation field in its Properties pane.

Application Folder from File System Editor is associated with TARGETDIR property. So if you really want to dynamically change it, you can set this property. This can be done through a type 51 custom action (property set with formatted text).

Unfortunately Visual Studio doesn't support this type of actions. So you can either edit the MSI with Orca to add it or use another setup authoring tool.

A type 51 action can set a folder property only before CostInitialize action. Since you want to set the default installation folder, your action should be scheduled in InstallUISequence table. This way the change will be visible in your installation UI.

After you configured the custom action you can condition it with VersionNT property. For example, your default installation path can be set for Windows 7:

[WindowsVolume]foo

In this case your custom action can set TARGETDIR to the Windows XP path:

D:\foo

and have this condition:

VersionNT = "501"
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号