如何在安装MSMQ队列时在WiX中指定一个知名用户

时间:2012-06-22 16:00:03

标签: wix msmq

我正在尝试编写一个WiX安装程序,它将安装具有众所周知权限的MSMQ队列,例如NetworkService。

看起来MessageQueuePermission标记允许指定User标记但是如何指定一个众所周知的用户?

1 个答案:

答案 0 :(得分:3)

以下WiX组件有效:

<?xml version="1.0" encoding="utf-8"?>
<!-- Message queues installation (MSMQ is used by NServiceBus). -->
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:msmq="http://schemas.microsoft.com/wix/MsmqExtension"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
     >
  <Fragment>
    <ComponentGroup Id="MessageQueues">
      <Component Id="MessageQueuesComponent"
                 Directory="INSTALLLOCATION"
                 Guid="C4BBEF3F-63A3-427E-A661-7A6E6BAFD543">
        <CreateFolder />

        <util:User Id="UserEveryOne"
                   CreateUser="no"
                   Name="Everyone"
                   />

        <!--Create the input queue.-->
        <msmq:MessageQueue
            Id="myinputqueue"
            Label="myinputqueue"
            PathName=".\private$\myinputqueue"
            PrivLevel="none"
            Transactional="yes">
          <msmq:MessageQueuePermission
            Id="myinputqueue"
            DeleteQueue="yes"
            QueueGenericAll="yes"
            ReceiveMessage="yes"
            TakeQueueOwnership="yes"
            User="UserEveryOne"
            WriteMessage="yes"
            />          
        </msmq:MessageQueue>

      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>