-
Notifications
You must be signed in to change notification settings - Fork 7
/
distribute.ps1
51 lines (43 loc) · 2.1 KB
/
distribute.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# ビルド
$msbuild = $null
$msbuild_exe = @(
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe",
"C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe")
foreach ($m in $msbuild_exe) {
if (Test-Path $m) {
$msbuild = $m
break
}
}
if ($null -eq $msbuild) {
Write-Output ("MSBuild.exe が見つかりませんでした。Visual Studio または Build Tools をインストールしてください。")
pause
return
}
& $msbuild DFAPlugin.sln /nologo /v:minimal /t:Clean /p:Configuration=Release /p:Platform="Any CPU" | Write-Output
& $msbuild DFAPlugin.sln /nologo /v:minimal /t:Restore /p:Configuration=Release /p:Platform="Any CPU" | Write-Output
& $msbuild DFAPlugin.sln /nologo /v:minimal /t:Rebuild /p:Configuration=Release /p:Platform="Any CPU" | Write-Output
# バージョン取得
$version = [System.Diagnostics.FileVersionInfo]::GetVersionInfo(".\DFAPlugin\bin\Release\DFAPlugin.dll").FileVersion
# フォルダ名
$buildFolder = ".\DFAPlugin\bin\Release"
$fullFolder = ".\Distribute\DFAPlugin-" + $version
# フォルダが既に存在するなら消去
if ( Test-Path $fullFolder -PathType Container ) {
Remove-Item -Recurse -Force $fullFolder
}
# フォルダ作成
New-Item -ItemType directory -Path $fullFolder
# full
xcopy /Y /R /S /EXCLUDE:full.exclude "$buildFolder\*" "$fullFolder"
cd Distribute
$folder = "DFAPlugin-" + $version
# アーカイブ
& "..\tools\7za.exe" "a" "$folder.7z" "$folder"
pause