この記事ngen
を使用してインストーラーに含めようとしています。インストール中に同期的に (優先度 = 0 で)実行したいのですが、実行するには管理者権限が必要です。そのため、ログに次のメッセージが表示されます。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
ngen の起動時に、この時点で (標準の UAC プロンプトを使用して) ユーザーに管理者権限を求める簡単な方法はありますか? ユーザーが「いいえ」を押すと、ngen なしで続行します。はいの場合 - ngen を実行し、アプリケーションをプリコンパイルします。何かご意見は?
ありがとう。