2

経由で MVC アプリケーションのコードをコンパイルしようとしていますMSBuild.exe以前はエラーが発生していましたが、この回答のおかげで、問題が何であるかがわかります。

間違ったバージョンを使用していましたMSBuild.exe

使用すべきバージョンがわかったので、psakeMSBuild.exeスクリプトが機能しません。ここにあるをターゲットにする方法がわかりません。

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe

私の psakeCompileタスクは現在このようになっていますが、VS は 7 行目で構文が間違っていると言っています。

task Compile `
    -description "Compile the code" `
    -requiredVariables $solutionFile, $buildConfiguration, $buildPlatform, $tempOutputDirectory `
    -depends Init {
        Write-Host $compileMessage
        Exec {
          "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" $solutionFile "/p:Configuration=$buildConfiguration;Platform=$buildPlatform;OutputDir=$tempOutputDirectory"
        }
}

以下を使用した場合、VS 2017 は構文について文句を言いませんがWebApplication.targets、ビルド スクリプトを実行するとエラーが発生します。これは、間違ったバージョンの MSBuild が使用されていることが原因であるに違いありません。

task Compile `
    -description "Compile the code" `
    -requiredVariables $solutionFile, $buildConfiguration, $buildPlatform, $tempOutputDirectory `
    -depends Init {
        Write-Host $compileMessage
        Exec {
          msbuild $solutionFile "/p:Configuration=$buildConfiguration;Platform=$buildPlatform;OutputDir=$tempOutputDirectory"
        }
}
4

0 に答える 0