tags:

views:

36

answers:

2

I want to default a proptery in my wix installation to a hardcoded directory. Is there a "correct" way to encode a default value (note, this is an internal project, not something distributed to the public) so I don't get the following warning:

LGHT1076: ICE48 Directory 'FOO' appears to be hardcoded in the property table to a local drive.

The wix file looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"&gt;
  <Product Id="22E1F223-E3AD-45F8-A394-1289AAAA64C8"
           Name="MyService"
           Language="1033" Version="1.0.0.0"
           UpgradeCode="140F5A44-58DA-4364-876B-9D9484C04CD9">
    <Package InstallerVersion="200" Compressed="yes" />

    <Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />

    <Property Id="FOO" Value="C:\MyRootDirectory\" />

Any thoughts on this?

+1  A: 

If you want to follow best practices ( I don't think you do here since you mention it's an 'internal' installer ) you shouldn't ever hard code paths. Choose a property like[WindowsVolume] ( http://msdn.microsoft.com/en-us/library/aa370905(v=VS.85).aspx ) and design your application to be flexible if WindowsVolume happens to not be C:

If you really don't care about this, you can use a custom action to set the property to what you want at the very beginning of the install. A simple Type 51 CA ( Set Property ) scheduled early on in both the UI and Execute Sequence will do the trick nicely. This way the property doesn't have the offending value when validation runs but then gets the value right away at the beginning of the install.

Christopher Painter
+1  A: 

If you only want to reference a certain directory in your directory tree as a property, then it is natively supported. Quoting MSDN, "When the directories are resolved during the CostFinalize action, the keys in the Directory table become properties set to directory paths"

Yan Sklyarenko