【问题标题】:Wix: LogonUser Property is not returning the expected valueWix:LogonUser 属性未返回预期值
【发布时间】:2015-01-03 13:02:29
【问题描述】:

我使用的是 WiX 3.9。有没有办法在 Wix 中获取当前登录的用户名。我一直在阅读很多在线帮助和文章,但到目前为止没有任何帮助......也许我犯了一些愚蠢的错误。 我添加了以下代码:

  <PropertyRef Id="LogonUser" />

  <Control Type="Edit" Id="UserNameEdit" Width="139" Height="15" X="191" Y="128" Property="USER_NAME" Text="[LogonUser]" />

但这给了我以下错误:error LGHT0094: Unresolved reference to symbol Property:LogonUser我不知道如何解决这个问题。

所以我刚刚删除了 PropertyRef 代码,但是 [LogonUser] 正在打印,因为它在编辑框中是 [LogonUser] 并且它不打印实际的用户名。

此外,当我检查安装日志文件时,我可以很好地查看 LogonUser 属性,如下所示:

 Property(C): LogonUser = JS.K

我已将 PropertyRef 用于 WIX_ACCOUNT_USERS 等,它工作正常,但对于 LogonUser 却没有。我是否缺少任何要参考的 dll?

【问题讨论】:

    标签: wix


    【解决方案1】:

    这对我有用:

     <Control Type="Edit" Id="UserNameEdit" Width="139" Height="15" X="191" Y="128" Property="USER_NAME" >
    <Text>{\DlgTitleFont}USER_NAME</Text>
      <Publish Property="USER_NAME" Value="[LogonUser]" Order="1">1</Publish> 
    
      </Control>

    因为您需要显式设置编辑控件的属性。

    【讨论】:

      【解决方案2】:

      没有LogonUser afaik。您应该创建一个新属性,并像这样初始化它:

      <SetProperty Id="INSTALL_USERNAME" Value="[%USERDOMAIN]\[%USERNAME]" /> 
      

      在显示 UI 之前安排:

      <InstallUISequence>
        <SetProperty Id="INSTALL_USERNAME" Before="Show" Value="[%USERDOMAIN]\[%USERNAME]" /> 
      </InstallUISequence>
      

      【讨论】:

        猜你喜欢
        • 2013-09-04
        • 2016-02-13
        • 2015-06-13
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-03-04
        相关资源
        最近更新 更多