目次

Visual Studio Installer Projects で "(ターゲット名) is not compatible with the project's target platform 'x86'" メッセージが表示されビルドができない - Visual Studio

Visual Studio Installer Project で "(ターゲット名) is not compatible with the project's target platform 'x86'" メッセージが表示されビルドができない現象の紹介です。

現象

Visual Studio Installer Projectでビルドすると
ERROR: File '(アプリケーションファイル.exe)' of project output 'プライマリ出力 from (プロジェクト名) (Release x64)' targeting 'AMD64' is not compatible with the project's target platform 'x86'
WARNING: File '(アプリケーションファイル.exe)' of project output 'プライマリ出力 from (プロジェクト名) (Release x64)' targeting 'x64' is not compatible with the project's target platform 'x86'

エラーが発生し、ビルドができません。x64のバイナリをビルドしようとする際に発生することが多いです。

原因

Visual Studio Installer Projectのターゲットが x86 のままになっていることが原因です。

対処法

Visual Studio Installer Projectのプロジェクトファイル".vdproj"ファイルをメモ帳などのテキストエディタで開きます。
ファイル内の "TargetPlatform" の値を確認します。 "3:0" となっています。これは x86 の設定です。


x64の設定にする場合は、"TargetPlatform" の値を "3:1" とします。


".vdproj"ファイルを保存し、Visual Studio でプロジェクトを読み込み、再度ビルドするとエラーが解消されます。

著者
iPentecのメインプログラマー
C#, ASP.NET の開発がメイン、少し前まではDelphiを愛用
掲載日: 2016-10-03
iPentec all rights reserverd.