I'm new to wix and msi but it looks like you'll need to use a custom action,
you could call into a dll or write a
vbscript (it looks like using scripts in custom actions may be frowned
upon), anyway you can set a property to a new
guid and then reference that, the simplest example would be with a vbscript
custom action.

<Product ...>

  ...

  <Binary Id="VbScriptKit" SourceFile="VbScriptKit.vbs"/>
  <CustomAction Id="CreateUserGuid" Return="check" BinaryKey="VbScriptKit"
VBScriptCall="CreateUserGuid"/>

  <InstallExecuteSequence>
    <Custom Action="CreateUserGuid" After="CostFinalize"/>
  </InstallExecuteSequence>
 
  ...

</Product>

---

VbScriptKit.vbs (make sure this is ASCII)

Option Explicit

Function CreateUserGuid()
  Session.Property("USERGUID") = Mid(CreateObject("Scriptlet.TypeLib").GUID,
2,36)
  CreateUserGuid = 1
End Function

---

you should make the function more robust but it's just an example.

Here's the relevant snippet of the install log:

Action ended 21:49:36: CostFinalize. Return value 1.
MSI (s) (74:20) [21:49:36:716]: Doing action: CreateUserGuid
MSI (s) (74:20) [21:49:36:716]: Note: 1: 2205 2:  3: ActionText
Action start 21:49:36: CreateUserGuid.
MSI (s) (74:20) [21:49:36:777]: Creating MSIHANDLE (29) of type 790542 for
thread 4128
MSI (s) (74:B4) [21:49:36:778]: Creating MSIHANDLE (30) of type 0 for thread
7604
MSI (s) (74:AC) [21:49:36:779]: Generating random cookie.
MSI (s) (74:AC) [21:49:36:809]: Created Custom Action Server with PID 2904
(0xB58).
MSI (s) (74:D4) [21:49:36:969]: Running as a service.
MSI (s) (74:D4) [21:49:36:973]: Hello, I'm your 32bit Impersonated custom
action server.
MSI (s) (74!20) [21:49:36:987]: PROPERTY CHANGE: Adding USERGUID property.
Its value is
'06520F92-D326-41FE-AAE9-0AC064D745CC'.
MSI (s) (74:B4) [21:49:36:988]: Closing MSIHANDLE (30) of type 0 for thread
7604
MSI (s) (74:B4) [21:49:36:988]: Closing MSIHANDLE (29) of type 790542 for
thread 4128
Action ended 21:49:36: CreateUserGuid. Return value 1.


Obviously you can do what you want with the USERGUID property, hope that
helps.


Steve Bush-2 wrote:
> 
> Does anyone know of an easy way in WIX to automatically create a GUID on
> install?  I want to create a GUID that represents the user and place it in
> the registry.  Here's an example:
> 
>                             <RegistryValue Root="HKCU"
> Key="Software\<omitted>" Name="UserId" Value="<newGuid>" Type="string"
> Action="write" />
> 
> 
> -------------------------------------------------------------------------
> 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
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Create-New-Guid-in-Installer-tp15548559p15560554.html
Sent from the wix-users mailing list archive at Nabble.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

Reply via email to