デプロイモジュールを発行するために
msbuild target.sln /p:VisualStudioVersion=14.0 /p:DeployOnBuild=true /p:Configuration=targetStaging /p:PublishProfile=targetProfile
をjenkinsのジョブに登録し、実行すると以下のエラーが発生。
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\Web\Transform\Microsoft.Web.Publishing.AspNetCompileMerge.targets(132,5): error :
Can't find the valid AspnetMergePath [C:\Jenkins\workspace\Common_Build\Apps\Pajdis.CommonAndPortal\Pajdis.CommonAndPortal\Pajdis.CommonAndPortal.csproj]
なにこれ。VisualStudioで発行するときに見たこと無いぞ。
とりあえずコマンドにAspnetMergePathを明示すれば動くだろ。
msbuild target.sln /p:VisualStudioVersion=14.0 /p:DeployOnBuild=true /p:Configuration=targetStaging /p:PublishProfile=targetProfile
/p:AspnetMergePath="C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\"
よっしゃ実行だ!
MSBUILD : error MSB1008: 1 つのプロジェクトのみを指定できます。
なん。。だと。。。。動かない。。。
よくよく見ると
Path To MSBuild.exe: msbuild.exe
Executing the command cmd.exe /C " msbuild.exe /p:VisualStudioVersion=14.0 /p:DeployOnBuild=true /p:Configuration=DebugPajdis /p:PublishProfile=DebugPajdis "\p:AspnetMergePath=C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools"" Apps\Pajdis.CommonAndPortal\Pajdis.CommonAndPortal.sln " && exit %%ERRORLEVEL%% from C:\Jenkins\workspace\Common_Build
[Common_Build] $ cmd.exe /C " msbuild.exe /p:VisualStudioVersion=14.0 /p:DeployOnBuild=true /p:Configuration=DebugPajdis /p:PublishProfile=DebugPajdis '\p:AspnetMergePath=C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools"' Apps\Pajdis.CommonAndPortal\Pajdis.CommonAndPortal.sln " && exit %%ERRORLEVEL%%
Microsoft (R) Build Engine バージョン 4.6.1086.0
[Microsoft .NET Framework、バージョン 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1008: 1 つのプロジェクトのみを指定できます。
スイッチ:Apps\Pajdis.CommonAndPortal\Pajdis.CommonAndPortal.sln
スイッチの構文については、"MSBuild /help" と入力してください。
Build step 'MSBuildの実行' marked build as failure
Finished: FAILURE
jenkinsさんの解釈がおかしいのかな。うん。
というわけでCan't find the valid AspnetMergePathで検索。
ここにたどり着いた。
結局、最初のエラーメッセージで指摘されたMicrosoft.Web.Publishing.AspNetCompileMerge.targetsを修正した。
<Target
Name="GetAspNetMergePath"
DependsOnTargets="$(GetAspNetMergePathDependsOn)"
Condition ="'$(GetAspNetMergePath)' != 'false'">
<PropertyGroup>
<!--追加する行-->
<TargetFrameworkSDKToolsDirectory>C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools\</TargetFrameworkSDKToolsDirectory>
<!--おわり-->
<AspnetMergeName>aspnet_merge.exe</AspnetMergeName>
<AspnetMergePath Condition="Exists('$(TargetFrameworkSDKToolsDirectory)$(AspnetMergeName)')">$(TargetFrameworkSDKToolsDirectory)</AspnetMergePath>
</PropertyGroup>
<Error Condition="'$(AspnetMergePath)' == '' Or !Exists($(AspnetMergePath))"
Text="Can't find the valid AspnetMergePath" />
</Target>
これで最初のジョブを実行することで無事にデプロイモジュールがjenkinsから発行できるように。