-
Notifications
You must be signed in to change notification settings - Fork 0
/
msbuild-afterbuild-nuget-script.bat
48 lines (43 loc) · 1.66 KB
/
msbuild-afterbuild-nuget-script.bat
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
@echo off
:: Afterbuild script (nuget related)
set NugetBin=nuget.exe
set DebugSymbols=""
set Symbols=".nupkg"
set NetworkRepo="\\NETWORK\PATH\ROUTE"
set ConfigName="$(ConfigurationName)"
:: Messages Vars
set MsgInit=- INIT POST BUILD NUGET PACKAGING -
set MsgNugetFound=Found '%NugetBin%'!
set MsgNetworkRepoFound=Found '%NetworkRepo%'!
set MsgNugetNotFound='%NugetBin%' is not installed on this machine. You cannot publish your nuget Package to %NetworkRepo%
set MsgNetworkRepoNotFound='%NetworkRepo%' cannot be found, unable to publish package
set MsgClearPreviosNugetPackage=Clear .nupkg on $(ProjectDir)bin\$(ConfigurationName)
set MsgPackingNuget=Packing $(ProjectDir)$(ProjectFileName)
set MsgAddingPackage=Adding packge to the network repo '%NetworkRepo%' of working dir '$(ProjectDir)'
:: INIT
echo %MsgInit%
:: Previous validation
%NugetBin% >nul 2>&1
if errorlevel 9009 if not errorlevel 9010 (
echo %MsgNugetNotFound%
exit /B 0
)
echo %MsgNugetFound%
dir %NetworkRepo% >nul 2>&1
if errorlevel 1 (
echo %MsgNetworkRepoNotFound%
exit /B 0
)
echo %MsgNetworkRepoFound%
:: Do the packaging stuff
echo # %MsgClearPreviosNugetPackage% #
del $(ProjectDir)bin\$(ConfigurationName)\*.nupkg
echo # %MsgPackingNuget% #
if %ConfigName% == "Debug" (
set DebugSymbols="-Symbols -Suffix $(ConfigurationName)"
)
set DebugSymbols=%DebugSymbols:"=%
set Symbols=%Symbols:"=%
%NugetBin% pack "$(ProjectDir)$(ProjectFileName)" -Properties Configuration=$(ConfigurationName) %DebugSymbols%
echo # %MsgAddingPackage% #
forfiles /P "$(ProjectDir)bin\$(ConfigurationName)" /m *%Symbols% /c "cmd /c %NugetBin% add "@FILE" -source %NetworkRepo%