2022年8月10日水曜日

【Jenkins】MSBuildの指定

 JenkinsでMSBuildを使って、Visual Studioのプロジェクトをビルドすると、バージョンが予定したものと異なったバージョンとでおこなってしまい、ビルドエラーとなってしまいました。

そこで、予定しているバージョンで行える方法について調べてみました。

1) コマンドラインで実行

VSごとのMSBuildの場所は下記のようにフォルダが異なっています

  • VS2010/VS2012 -> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"
  • VS2012 -> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"

  • VS2013 -> "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe"
  • VS2015 -> "C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe"
  • VS2017 -> "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\MSBuild.exe"

 

"C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" "project.sln" /t:rebuild /p:Configuration=Release;Platform="Win32"

上記の引数について、
 "project.sln" --> ソリューション指定
 /t:rebuild --> ビルド方法(build/rebuild/clean)
 /p:Configuration=Release;Platform="Win32" -> ビルド構成(Debug/Release)、Platform指定(Win32/x64)

 

2),NETのバージョンを指定

SET MSBUILD="C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe"

%MSBUILD% ClassLibrary1.csproj /p:TargetFrameworkVersion=v4.0 /p:Configuration=Release /t:Rebuild

 ⇒/p:TargetFrameworkVersion=v4.0
ビルドパラメーターでTargetFrameworkVersionを指定します。

 

3) jenkinsでの設定

・Jenkinsトップページから、Jenkinsの管理-Global Tool Configuration を開く

・MSBuildボタン押下

・"名前"に任意の名前を設定

・"MSBuild.exeファイルパス"にパスを設定 Visual Studio Community 2015 の場合は → 「C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe」

・Saveボタン押下


※オプションの/pはPropertyを示しています。

MSBuildの詳細は、以下URL一読お勧めいたします。

https://atmarkit.itmedia.co.jp/fdotnet/special/msbuild01/msbuild01_01.html

https://atmarkit.itmedia.co.jp/fdotnet/special/msbuild01/msbuild01_02.html


【参考URL】

https://blog.kakakikikeke.com/2013/08/windowsjenkins.html

https://www.orzmakotoblog.net/entry/2015/05/17/143832

https://qiita.com/ryo2i/items/f2028c62a03b8b0b9d85

https://qiita.com/lusf/items/3d307daa6a87e24a747f

https://qiita.com/bonny_d/items/f274f7b2cceb06cbe3b3


2022年8月9日火曜日

VS2015のインストール

 以下のサイトの通りに実行したら、VS2015Community(無償版)インストールできました。

https://www.kkaneko.jp/tools/win/visualstudio2015.html

 

ダウンロードはDVD用(ISO)なので、以下のサイトを参考にして、「エクスプローラー」から実行できました

https://www.fmworld.net/cs/azbyclub/qanavi/jsp/qacontents.jsp?PID=1811-1205

 

Visual Studio でNugetのURL

 Visual Studio でNugetでパッケージ取得するときのURLを調べてみました。

下記サイトにVisualStudioごとにURLがまとまっていました。

 

https://pswork.jp/dotnet/visual-studio-nuget-packagesource/ 


●VisualStudio2015

nuget.org
https://api.nuget.org/v3/index.json

Microsoft and .NET
https://www.nuget.org/api/v2/curated-feeds/microsoftdotnet/

Microsoft Visual Studio Offline Packages
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\