Wednesday 31 October 2012

Create MSMQ Private Queue using Wix Installer

I was trying to create a public queue using Wix but could not, so in the end I gave up and went with a private one with enough permissions for my purposes.

The snippet shows how to do this. There is a check to ensure that MSMQ is installed and because we are using Win 2008 R2 and compiling in Windows XP, the win64 attribute is set to yes.

<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:msmq="http://schemas.microsoft.com/wix/MsmqExtension">

<Property Id="MSMQ" >
 <RegistrySearch Id="msmq" Type="raw" Root="HKLM" Key="SOFTWARE\Microsoft\MSMQ\Parameters\CurrentBuild" Win64="yes"/>
</Property>

<Condition Message="Please Ensure that MS MQ is installed">
 <![CDATA[Installed or MSMQ]]>
</Condition>

<util:Group Id="Admins" Name="Administrators"/>
<util:Group Id="Everyone" Name="Everyone"/>

<msmq:MessageQueue Id="fil1004" Label="Log Queue" PathName=".\Private$\logging" Transactional="no" PrivLevel="none" >
 <msmq:MessageQueuePermission Id="fil1005" Group="Admins" QueueGenericAll="yes"/> 
 <msmq:MessageQueuePermission Id="fil1006" Group="Everyone" GetQueueProperties="yes" GetQueuePermissions="yes" WriteMessage="yes" />            
</msmq:MessageQueue>

2 comments:

  1. Just a small typo, the namespace in the last block is incorrect, (msqm rather than msmq).
    Nick

    ReplyDelete