1
我正在嘗試使用this article將ngen
添加到我的安裝程序中。我想在安裝過程中同步運行ngen
(優先級= 0),但它需要管理權限才能運行。所以,現在我已經在日誌中以下消息:如何使用提升的權限從WiX運行ngen?
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
有沒有簡單的方法來詢問用戶的管理權限(使用標準的UAC提示),在這一刻,當NGEN開始?如果用戶按「否」,我想繼續沒有ngen。如果是 - 運行ngen並預編譯我的應用程序。 有什麼想法?
謝謝。