【问题标题】:How to run ngen from WiX with elevated rights?如何以提升的权限从 WiX 运行 ngen?
【发布时间】:2011-04-08 15:44:03
【问题描述】:

我正在尝试使用this articlengen 包含到我的安装程序中。我想在安装过程中同步运行ngen(优先级=0),但它需要管理权限才能运行。所以,现在我在日志中有以下消息:

MSI (s) (74:2C) [18:30:14:310]: Invoking remote custom action. DLL: C:\windows\Installer\MSI60B0.tmp, Entrypoint: ExecNetFx
ExecNetFx:  Microsoft (R) CLR Native Image Generator - Version 4.0.30319.1
ExecNetFx:  Copyright (c) Microsoft Corporation.  All rights reserved.
ExecNetFx:  Installing assembly C:\myapp\myapp.exe
ExecNetFx:  Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
ExecNetFx:  Administrator permissions are needed to use the selected options.  Use an administrator command prompt to complete these tasks.
ExecNetFx:  Error 0xffffffff: Command line returned an error.
ExecNetFx:  failed to execute Ngen command (with error 0xffffffff): C:\windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe install "C:\myapp\myapp.exe", continuing anyway
ExecNetFx:  Microsoft (R) CLR Native Image Generator - Version 4.0.30319.1
ExecNetFx:  Copyright (c) Microsoft Corporation.  All rights reserved.
ExecNetFx:  Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
ExecNetFx:  Administrator permissions are needed to use the selected options.  Use an administrator command prompt to complete these tasks.
ExecNetFx:  Error 0xffffffff: Command line returned an error.
ExecNetFx:  failed to execute Ngen command (with error 0xffffffff): C:\windows\Microsoft.NET\Framework\v4.0.30319\ngen.exe update /queue, continuing anyway

当 ngen 启动时,是否有简单的方法来向用户询问管理权限(使用标准 UAC 提示符)?如果用户按“否”,我想在没有 ngen 的情况下继续。如果是 - 运行 ngen 并预编译我的应用程序。 有什么想法吗?

谢谢。

【问题讨论】:

    标签: wix uac ngen


    【解决方案1】:

    WiX 已经运行提升的 NGen 自定义操作 (Execute="deferred" Impersonate="no")。您的 .msi 包必须是每台机器才能运行它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-02-02
      • 1970-01-01
      • 2013-11-09
      • 2017-09-08
      • 2020-05-21
      • 2018-11-29
      • 2011-12-16
      相关资源
      最近更新 更多