如何从提升权限的WiX运行ngen?

我试图使用这篇文章将
ngen
包含在我的安装程序中。我想在安装期间同步运行
ngen
(优先级= 0),但它需要管理权限才能运行。所以,现在我在日志中有以下消息:
MSI (s) (74:2C) [18:30:14:310]: Invoking remote custom action. DLL: C:windowsInstallerMSI60B0.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:myappmyapp.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:windowsMicrosoft.NETFrameworkv4.0.30319ngen.exe install "C:myappmyapp.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:windowsMicrosoft.NETFrameworkv4.0.30319ngen.exe update /queue, continuing anyway
当ngen启动时,是否有简单的方法来询问用户管理权限(使用标准的UAC提示)?如果用户按“否”,我想在没有ngen的情况下继续。如果是 - 运行ngen并预编译我的应用程序。 有什么想法吗? 谢谢。     
已邀请:
WiX已经提升了NGen自定义操作(Execute =“deferred”Impersonate =“no”)。您的.msi程序包必须是每台计算机才能运行它们。     

要回复问题请先登录注册