Hey Raj,
As a side note on this, I wrote a little app that goes over the heat
generated output and uses the lower-case, variablized value of the Source
attribute of the File elment. I then take that element and hash to generate
a, more then likely, unique file ID. The process looks something like this.
*Heat Output:*
<Directory Id="Website" Name="Website">
<Component Id="AddCategory.aspx" Guid="PUT-GUID-HERE">
<File Id="AddCategory.aspx" Name="AddCategory.aspx" KeyPath="yes"
Source="D
:\Development\PIDashboard\_OUTPUT_\1.0.0\Debug\App\Website\AddCategory.aspx"
/>
</Component>
*Re-org:*
<Directory Id="Website" Name="Website">
<Component Id="AddCategory.aspx" Guid="PUT-GUID-HERE">
<File Id="AddCategory.aspx" Name="AddCategory.aspx" KeyPath="yes"
Source="$(var.RootPath)\AddCategory.aspx" />
</Component>
*Hash:*
$(var.Root)\Website\AddCategory.aspx = $(var.root)\website\addcategory.aspx
protected string GetHashString(string s)
{
StringBuilder sb = new StringBuilder();
UTF8Encoding enc = new UTF8Encoding();
HashAlgorithm alg = HashAlgorithm.Create("MD5");
byte[] hash = alg.ComputeHash(enc.GetBytes(s));
foreach (byte x in hash)
{
sb.AppendFormat("{0:X2}", x);
}
return sb.ToString();
}
Output = CAE00571B0687E8E2CBD42D8F2D711F6
*Final Result:*
<Directory Id="D_903BF5C74F67E118C77BB96BA956A5CE" Name="Website">
<Component Id="CK_102FD739712DE86F5AC38CE8AA5E567A"
Guid="{B73B5A74-79AA-4E73-B23C-9F54E42FF494}">
<File Id="F_CAE00571B0687E8E2CBD42D8F2D711F6" Name="
AddCategory.aspx" KeyPath="yes" Source="$(var.RootPath)\AddCategory.aspx" />
</Component>
The major problem with the app is that it regenerates GUIDs each time it
runs. This is required in the build environment this is executed in at the
moment. The hope is to look up GUIDs from some for of data store to keep
with the best practices of components in Windows Installer.
Besides that, this should let you keep same named files in different
directories from colliding. It should also ensure that the file is unique
via its location if you want to reference later inside of the installer.
[#F_CAE00571B0687E8E2CBD42D8F2D711F6]
Hope that helps,
--
Brian Rogers
"Intelligence removes complexity." - BR
http://www.codeplex.com/wixml/
On Tue, Feb 12, 2008 at 3:19 PM, Tanikella, Rajanikanth (SCR US) <
[EMAIL PROTECTED]> wrote:
> Thanks again, Bob.
>
> Regarding that undefined behavior, what I'm seeing is that candle
> warnings about component id length are becoming errors reported by light
> as duplicate component ids. They are duplicate components because in
> the wixobj file the id fields are empty. At least that is my current
> hunch based on the clues.
>
> Thanks again for the insights!
>
> Raj
>
> -----Original Message-----
> From: Bob Arnson [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 06, 2008 11:25 PM
> To: Tanikella, Rajanikanth (SCR US)
> Cc: wix-users@lists.sourceforge.net
> Subject: Re: [WiX-users] Heating Directories with Identically Named
> Files
>
> Tanikella, Rajanikanth (SCR US) wrote:
> > Which leads to the next question: What might be the downside of not
> > heeding this warning?
>
> Undefined behavior.
>
> > So far I haven't seen Ids that are non-unique
> > within their first 72 characters.
>
> Then truncate as 72 and you'll get duplicate ID errors rather than
> something that might or might not work.
>
> --
> sig://boB
> http://joyofsetup.com/
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users
>
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users