-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.cmd
50 lines (41 loc) · 1.72 KB
/
build.cmd
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
@echo off
set appname=Emi
set cwd=%CD%
set outputdir=%cwd%\build
set commonflags=/p:Configuration=Release;AllowUnsafeBlocks=False /p:CLSCompliant=True /p:Platform="Any Cpu" /p:langversion=7
set nugetversion=latest
set cachednuget=%LocalAppData%\NuGet\nuget.%nugetversion%.exe
set msbuild="C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe"
goto build
:build-error
echo Failed to compile.
goto exit
:build
echo ---------------------------------------------------------------------
echo Building AnyCpu release...
%msbuild% %appname%.sln /t:%appname% %commonflags% /p:TargetFrameworkVersion=v3.5 /p:OutputPath="%outputdir%\net35"
if errorlevel 1 goto build-error
%msbuild% %appname%.sln /t:%appname% %commonflags% /p:TargetFrameworkVersion=v4.0 /p:OutputPath="%outputdir%\net40"
if errorlevel 1 goto build-error
%msbuild% %appname%.sln /t:%appname% %commonflags% /p:TargetFrameworkVersion=v4.5 /p:OutputPath="%outputdir%\net45"
if errorlevel 1 goto build-error
:done
echo.
echo ---------------------------------------------------------------------
echo Compile finished.
echo.
if exist %cachednuget% goto copynuget
echo Downloading latest version of NuGet.exe...
if not exist %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/%nugetversion%/nuget.exe' -OutFile '%cachednuget%'"
goto createpackage
:copynuget
if exist .nuget\nuget.exe goto createpackage
md .nuget
copy %cachednuget% .nuget\nuget.exe > nul
:createpackage
echo Creating nuget package...
.nuget\nuget.exe pack %appname%.nuspec -OutputDirectory "%outputdir%"
cd %cwd%
goto exit
:exit