-
Notifications
You must be signed in to change notification settings - Fork 152
/
build.bat
393 lines (322 loc) · 22.2 KB
/
build.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
@ECHO OFF
set visualStudioPath=%programfiles%\Microsoft Visual Studio\2022\Community
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
set buildNumber=0
set copyrightYear=%datetime:~0,4%
set version=%1
set prereleasePostfix=
set releaseNotesUrl=https://github.com/simpleinjector/SimpleInjector/releases/tag/v
IF "%2"=="1" (
set step=%2
) ELSE IF "%2"=="2" (
set step=%2
) ELSE IF "%2"=="3" (
set step=%2
) ELSE IF "%2"=="4" (
set step=%2
) ELSE IF "%2"=="5" (
set step=%2
) ELSE (
set step=%3
set prereleasePostfix=%2
)
set inputOk=true
IF "%version%"=="" (
set inputOk=false
) ELSE IF "%step%"=="" (
set inputOk=false
)
for /f "tokens=1,2,3 delims=. " %%a in ("%version%") do set version_major=%%a&set version_minor=%%b&set version_patch=%%c
echo step: %step%
echo version: %version% (major: %version_major%, minor: %version_minor%, patch: %version_patch%)
echo prereleasePostfix: %prereleasePostfix%
IF "%inputOk%"=="false" (
rem I would have loved doing this all in one single step, but for some reason, I can't seem to build using MSBuild
rem while running from the command line using MSBuild 2017. See https://stackoverflow.com/questions/47002571/.
rem That's why this build file must be called multiple times.
echo Please provide both the version number and the number of the of the build step. Starting with 1.
echo Usage: "%0 [version] {-[prerelease postfix]} [step]
echo Example1: "%0 5.0.0 -beta1 1
echo Example2: "%0 5.0.0 1
goto :EOF
)
set /a nextMajorVersion=%version_major%+1
set version_Core=%version%
set version_DynamicAssemblyCompilation=%version_Core%
set version_Packaging=%version_Core%
set version_Integration_Web=%version_Core%
set version_Integration_WebForms=%version_Core%
set version_Integration_Mvc=%version_Core%
set version_Integration_Wcf=%version_Core%
set version_Integration_WebApi=%version_Core%
set referenceLibraryPath=..\..\simpleinjector-website.github.io\ReferenceLibrary
if not exist %referenceLibraryPath% goto :referenceLibraryPath_missing
set vsvars32_bat="%visualStudioPath%\Common7\Tools\VsMSBuildCmd.bat"
if not exist %vsvars32_bat% goto :vsvars32_bat_missing
@call %vsvars32_bat%
set msbuild="%visualStudioPath%\MSBuild\Current\Bin\MSBuild.exe"
if not exist %msbuild% goto :msbuild_exe_missing
set attrib=%systemroot%\System32\attrib.exe
set xcopy=%systemroot%\System32\xcopy.exe
if not exist %xcopy% goto :xcopy_missing
set buildToolsPath=BuildTools
set nugetTemplatePath=%buildToolsPath%\NuGet
rem replace.exe can replace one text for another in a given file
set replace=%buildToolsPath%\replace.exe
rem zipreplace.exe does what replace.exe does, but now inside a .zip file.
set zipreplace=%buildToolsPath%\zipreplace.exe
set compress=%systemroot%\System32\CScript.exe %buildToolsPath%\zip.vbs
set configuration=Release
set defineConstantsNet=PUBLISH
set targetPath=bin
set targetPathNet=%targetPath%\NET
set targetPathPcl=%targetPath%\PCL
set targetPathCoreClr=%targetPath%\DOTNET
set named_version=%version%%prereleasePostfix%
set named_version_Core=%version_Core%%prereleasePostfix%
set named_version_DynamicAssemblyCompilation=%version_DynamicAssemblyCompilation%%prereleasePostfix%
set named_version_Integration_Wcf=%version_Integration_Wcf%%prereleasePostfix%
set named_version_Integration_Web=%version_Integration_Web%%prereleasePostfix%
set named_version_Integration_Mvc=%version_Integration_Mvc%%prereleasePostfix%
set named_version_Integration_WebApi=%version_Integration_WebApi%%prereleasePostfix%
set named_version_Packaging=%version_Packaging%%prereleasePostfix%
set numeric_version_Core=%version_Core%.%buildNumber%
set numeric_version_DynamicAssemblyCompilation=%version_DynamicAssemblyCompilation%.%buildNumber%
set numeric_version_Integration_Wcf=%version_Integration_Wcf%.%buildNumber%
set numeric_version_Integration_Web=%version_Integration_Web%.%buildNumber%
set numeric_version_Integration_Mvc=%version_Integration_Mvc%.%buildNumber%
set numeric_version_Integration_WebApi=%version_Integration_WebApi%.%buildNumber%
set numeric_version_Packaging=%version_Packaging%.%buildNumber%
if not exist SimpleInjector.snk goto :strong_name_key_missing
echo Initialization complete
IF %step%==1 (
echo Running step 1: Cleaning solution and setting version numbers
if exist Releases\v%named_version% goto :release_directory_already_exists
echo BUILDING
rmdir %targetPathNet% /s /q
mkdir %targetPathNet%
rmdir %targetPathPcl% /s /q
mkdir %targetPathPcl%
rmdir %targetPathCoreClr% /s /q
mkdir %targetPathCoreClr%
echo CLEAN SOLUTION
%msbuild% /t:Clean /p:Configuration=Release
echo SET VERSION NUMBERS
%replace% /line "<VersionPrefix>" "<VersionPrefix>%named_version_Core%</VersionPrefix>" /source:SimpleInjector\SimpleInjector.csproj
%replace% /line "<VersionPrefix>" "<VersionPrefix>%named_version_DynamicAssemblyCompilation%</VersionPrefix>" /source:SimpleInjector.DynamicAssemblyCompilation\SimpleInjector.DynamicAssemblyCompilation.csproj
%replace% /line "<VersionPrefix>" "<VersionPrefix>%named_version_Integration_Wcf%</VersionPrefix>" /source:SimpleInjector.Integration.Wcf\SimpleInjector.Integration.Wcf.csproj
%replace% /line "<VersionPrefix>" "<VersionPrefix>%named_version_Integration_Web%</VersionPrefix>" /source:SimpleInjector.Integration.Web\SimpleInjector.Integration.Web.csproj
%replace% /line "<VersionPrefix>" "<VersionPrefix>%named_version_Integration_Mvc%</VersionPrefix>" /source:SimpleInjector.Integration.Web.Mvc\SimpleInjector.Integration.Web.Mvc.csproj
%replace% /line "<VersionPrefix>" "<VersionPrefix>%named_version_Integration_WebApi%</VersionPrefix>" /source:SimpleInjector.Integration.WebApi\SimpleInjector.Integration.WebApi.csproj
%replace% /line "<VersionPrefix>" "<VersionPrefix>%named_version_Packaging%</VersionPrefix>" /source:SimpleInjector.Packaging\SimpleInjector.Packaging.csproj
rem echo BUILD SOLUTION
rem %msbuild% "SimpleInjector\SimpleInjector.csproj" /nologo
rem %msbuild% "SimpleInjector.Integration.ServiceCollection\SimpleInjector.Integration.ServiceCollection.csproj" /nologo
rem %msbuild% "SimpleInjector.Integration.AspNetCore\SimpleInjector.Integration.AspNetCore.csproj" /nologo
rem %msbuild% "SimpleInjector.Integration.AspNetCore.Mvc.Core\SimpleInjector.Integration.AspNetCore.Mvc.Core.csproj" /nologo
rem %msbuild% "SimpleInjector.Integration.AspNetCore.Mvc\SimpleInjector.Integration.AspNetCore.Mvc.csproj" /nologo
rem %msbuild% "SimpleInjector.Integration.Wcf\SimpleInjector.Integration.Wcf.csproj" /nologo
rem %msbuild% "SimpleInjector.Integration.Web\SimpleInjector.Integration.Web.csproj" /nologo
rem %msbuild% "SimpleInjector.Integration.Web.Mvc\SimpleInjector.Integration.Web.Mvc.csproj" /nologo
rem %msbuild% "SimpleInjector.Integration.WebApi\SimpleInjector.Integration.WebApi.csproj" /nologo
rem %msbuild% "SimpleInjector.Packaging\SimpleInjector.Packaging.csproj" /nologo
echo Please compile the solution in RELEASE mode and run step 2
goto :EOF
)
IF %step%==2 (
echo Running step 2: RUNNING TESTS IN PARTIAL TRUST
set testDll=SimpleInjector.Tests.Unit\bin\Release\net461\SimpleInjector.Tests.Unit.dll
set testRunner=PartialTrustTestRunner\bin\Release\net461\PartialTrustTestRunner.exe
echo %testRunner% %testDll%
%testRunner% %testDll%
set testDll2=SimpleInjector.Conventions.Tests\bin\Release\net472\SimpleInjector.Conventions.Tests.dll
echo %testRunner% %testDll2%
%testRunner% %testDll2%
echo If tests were green, please run step 3
goto :EOF
)
IF %step%==3 (
echo Running step 3: BUILDING DOCUMENTATION
%msbuild% "SimpleInjector.Documentation\SimpleInjector.Documentation.shfbproj" /nologo /p:Configuration=%configuration% /p:DefineConstants="%defineConstantsNet%"
mkdir Releases\v%named_version%
copy Help\SimpleInjector.chm Releases\v%named_version%\SimpleInjector.chm
echo CREATING ONLINE DOCUMENTATION
del Help\SimpleInjector.chm
del Help\*.aspx
del Help\*.php
copy Help\Index.html Help\index.tmp
del Help\Index.html
copy Help\index.tmp Help\index.htm
del Help\index.tmp
REM For some strange reason, the following call does not compress the complete help directory, while calling it manually does work
REM %compress% "%CD%\Help" "%CD%\Releases\v%named_version%\SimpleInjector Online Documentation v%named_version%.zip"
IF "%prereleasePostfix%"=="" (
echo COPYING ONLINE DOCUMENTATION TO WEBSITE REPOSITORY
%xcopy% Help %referenceLibraryPath% /E /H /Y /I
%xcopy% Help %referenceLibraryPath%\%version_major%.%version_minor% /E /H /Y /I
)
echo Please run step 4
goto :EOF
)
IF %step%==4 (
echo Running step 4: CREATING NUGET PACKAGES
rmdir Releases\temp /s /q
mkdir Releases\temp
%xcopy% %nugetTemplatePath%\.NET\SimpleInjector Releases\temp /E /H
%attrib% -r "%CD%\Releases\temp\*.*" /s /d
del Releases\temp\.gitignore /s /q
copy SimpleInjector\bin\Release\net45\SimpleInjector.dll Releases\temp\lib\net45\SimpleInjector.dll
copy SimpleInjector\bin\Release\net45\SimpleInjector.xml Releases\temp\lib\net45\SimpleInjector.xml
copy SimpleInjector\bin\Release\net461\SimpleInjector.dll Releases\temp\lib\net461\SimpleInjector.dll
copy SimpleInjector\bin\Release\net461\SimpleInjector.xml Releases\temp\lib\net461\SimpleInjector.xml
copy SimpleInjector\bin\Release\netstandard1.0\SimpleInjector.dll "Releases\temp\lib\netstandard1.0\SimpleInjector.dll"
copy SimpleInjector\bin\Release\netstandard1.0\SimpleInjector.xml "Releases\temp\lib\netstandard1.0\SimpleInjector.xml"
copy SimpleInjector\bin\Release\netstandard1.3\SimpleInjector.dll "Releases\temp\lib\netstandard1.3\SimpleInjector.dll"
copy SimpleInjector\bin\Release\netstandard1.3\SimpleInjector.xml "Releases\temp\lib\netstandard1.3\SimpleInjector.xml"
copy SimpleInjector\bin\Release\netstandard2.0\SimpleInjector.dll "Releases\temp\lib\netstandard2.0\SimpleInjector.dll"
copy SimpleInjector\bin\Release\netstandard2.0\SimpleInjector.xml "Releases\temp\lib\netstandard2.0\SimpleInjector.xml"
copy SimpleInjector\bin\Release\netstandard2.1\SimpleInjector.dll "Releases\temp\lib\netstandard2.1\SimpleInjector.dll"
copy SimpleInjector\bin\Release\netstandard2.1\SimpleInjector.xml "Releases\temp\lib\netstandard2.1\SimpleInjector.xml"
%replace% /source:Releases\temp\SimpleInjector.nuspec {version} %named_version_Core%
%replace% /source:Releases\temp\SimpleInjector.nuspec {year} %copyrightYear%
%replace% /source:Releases\temp\package\services\metadata\core-properties\c8082e2254fe4defafc3b452026f048d.psmdcp {version} %named_version_Core%
%compress% "%CD%\Releases\temp" "%CD%\Releases\v%named_version%\SimpleInjector.%named_version_Core%.zip"
rmdir Releases\temp /s /q
mkdir Releases\temp
%xcopy% %nugetTemplatePath%\.NET\SimpleInjector.Packaging Releases\temp /E /H
%attrib% -r "%CD%\Releases\temp\*.*" /s /d
del Releases\temp\.gitignore /s /q
copy SimpleInjector.Packaging\bin\Release\net45\SimpleInjector.Packaging.dll "Releases\temp\lib\net45\SimpleInjector.Packaging.dll"
copy SimpleInjector.Packaging\bin\Release\net45\SimpleInjector.Packaging.xml "Releases\temp\lib\net45\SimpleInjector.Packaging.xml"
copy SimpleInjector.Packaging\bin\Release\netstandard1.0\SimpleInjector.Packaging.dll "Releases\temp\lib\netstandard1.0\SimpleInjector.Packaging.dll"
copy SimpleInjector.Packaging\bin\Release\netstandard1.0\SimpleInjector.Packaging.xml "Releases\temp\lib\netstandard1.0\SimpleInjector.Packaging.xml"
%replace% /source:Releases\temp\SimpleInjector.Packaging.nuspec {version} %named_version_Packaging%
%replace% /source:Releases\temp\SimpleInjector.Packaging.nuspec {versionCore} %named_version_Core%
%replace% /source:Releases\temp\SimpleInjector.Packaging.nuspec {year} %copyrightYear%
%replace% /source:Releases\temp\package\services\metadata\core-properties\4d447eef3ba54c2da48c4d25f475fcbe.psmdcp {version} %named_version_Packaging%
%compress% "%CD%\Releases\temp" "%CD%\Releases\v%named_version%\SimpleInjector.Packaging.%named_version_Packaging%.zip"
rmdir Releases\temp /s /q
mkdir Releases\temp
%xcopy% %nugetTemplatePath%\.NET\SimpleInjector.Integration.Web Releases\temp /E /H
%attrib% -r "%CD%\Releases\temp\*.*" /s /d
del Releases\temp\.gitignore /s /q
copy SimpleInjector.Integration.Web\bin\Release\net45\SimpleInjector.Integration.Web.dll Releases\temp\lib\net45\SimpleInjector.Integration.Web.dll
copy SimpleInjector.Integration.Web\bin\Release\net45\SimpleInjector.Integration.Web.xml Releases\temp\lib\net45\SimpleInjector.Integration.Web.xml
%replace% /source:Releases\temp\SimpleInjector.Integration.Web.nuspec {version} %named_version_Integration_Web%
%replace% /source:Releases\temp\SimpleInjector.Integration.Web.nuspec {versionCore} %named_version_Core%
%replace% /source:Releases\temp\SimpleInjector.Integration.Web.nuspec {year} %copyrightYear%
%replace% /source:Releases\temp\package\services\metadata\core-properties\fb4dd696b20548afa09bcbbf3ea6c7d0.psmdcp {version} %named_version_Integration_Web%
%compress% "%CD%\Releases\temp" "%CD%\Releases\v%named_version%\SimpleInjector.Integration.Web.%named_version_Integration_Web%.zip"
rmdir Releases\temp /s /q
mkdir Releases\temp
%xcopy% %nugetTemplatePath%\.NET\SimpleInjector.Integration.Web.Mvc Releases\temp /E /H
%attrib% -r "%CD%\Releases\temp\*.*" /s /d
del Releases\temp\.gitignore /s /q
copy SimpleInjector.Integration.Web.Mvc\bin\Release\net45\SimpleInjector.Integration.Web.Mvc.dll Releases\temp\lib\net45\SimpleInjector.Integration.Web.Mvc.dll
copy SimpleInjector.Integration.Web.Mvc\bin\Release\net45\SimpleInjector.Integration.Web.Mvc.xml Releases\temp\lib\net45\SimpleInjector.Integration.Web.Mvc.xml
%replace% /source:Releases\temp\SimpleInjector.Integration.Web.Mvc.nuspec {version} %named_version_Integration_Mvc%
%replace% /source:Releases\temp\SimpleInjector.Integration.Web.Mvc.nuspec {versionCore} %named_version_Core%
%replace% /source:Releases\temp\SimpleInjector.Integration.Web.Mvc.nuspec {version_Integration_Web} %named_version_Integration_Web%
%replace% /source:Releases\temp\SimpleInjector.Integration.Web.Mvc.nuspec {year} %copyrightYear%
%replace% /source:Releases\temp\package\services\metadata\core-properties\916f6977dc7a462395f59f05d2cc6a76.psmdcp {version} %named_version_Integration_Mvc%
%compress% "%CD%\Releases\temp" "%CD%\Releases\v%named_version%\SimpleInjector.Integration.Web.Mvc.%named_version_Integration_Mvc%.zip"
rmdir Releases\temp /s /q
mkdir Releases\temp
%xcopy% %nugetTemplatePath%\.NET\SimpleInjector.Integration.Web.Mvc.QuickStart Releases\temp /E /H
%attrib% -r "%CD%\Releases\temp\*.*" /s /d
del Releases\temp\.gitignore /s /q
%replace% /source:Releases\temp\SimpleInjector.MVC3.nuspec {version} %named_version_Integration_Mvc%
%replace% /source:Releases\temp\SimpleInjector.MVC3.nuspec {versionCore} %named_version_Core%
%replace% /source:Releases\temp\SimpleInjector.MVC3.nuspec {version_Integration_Mvc} %named_version_Integration_Mvc%
%replace% /source:Releases\temp\SimpleInjector.MVC3.nuspec {year} %copyrightYear%
%replace% /source:Releases\temp\package\services\metadata\core-properties\7594fa13b1164869a9b2b67b8b5ad9a3.psmdcp {version} %named_version_Integration_Mvc%
%compress% "%CD%\Releases\temp" "%CD%\Releases\v%named_version%\SimpleInjector.MVC3.%named_version_Integration_Mvc%.zip"
rmdir Releases\temp /s /q
mkdir Releases\temp
%xcopy% %nugetTemplatePath%\.NET\SimpleInjector.Integration.Wcf Releases\temp /E /H
%attrib% -r "%CD%\Releases\temp\*.*" /s /d
del Releases\temp\.gitignore /s /q
copy SimpleInjector.Integration.Wcf\bin\Release\net45\SimpleInjector.Integration.Wcf.dll Releases\temp\lib\net45\SimpleInjector.Integration.Wcf.dll
copy SimpleInjector.Integration.Wcf\bin\Release\net45\SimpleInjector.Integration.Wcf.xml Releases\temp\lib\net45\SimpleInjector.Integration.Wcf.xml
%replace% /source:Releases\temp\SimpleInjector.Integration.Wcf.nuspec {version} %named_version_Integration_Wcf%
%replace% /source:Releases\temp\SimpleInjector.Integration.Wcf.nuspec {versionCore} %named_version_Core%
%replace% /source:Releases\temp\SimpleInjector.Integration.Wcf.nuspec {year} %copyrightYear%
%replace% /source:Releases\temp\package\services\metadata\core-properties\13850374b87d467da12f21ca32dac632.psmdcp {version} %named_version_Integration_Wcf%
%compress% "%CD%\Releases\temp" "%CD%\Releases\v%named_version%\SimpleInjector.Integration.Wcf.%named_version_Integration_Wcf%.zip"
rmdir Releases\temp /s /q
mkdir Releases\temp
%xcopy% %nugetTemplatePath%\.NET\SimpleInjector.Integration.Wcf.QuickStart Releases\temp /E /H
%attrib% -r "%CD%\Releases\temp\*.*" /s /d
del Releases\temp\.gitignore /s /q
%replace% /source:Releases\temp\SimpleInjector.Integration.Wcf.QuickStart.nuspec {version} %named_version_Integration_Wcf%
%replace% /source:Releases\temp\SimpleInjector.Integration.Wcf.QuickStart.nuspec {versionCore} %named_version_Core%
%replace% /source:Releases\temp\SimpleInjector.Integration.Wcf.QuickStart.nuspec {version_Integration_Wcf} %named_version_Integration_Wcf%
%replace% /source:Releases\temp\SimpleInjector.Integration.Wcf.QuickStart.nuspec {year} %copyrightYear%
%replace% /source:Releases\temp\package\services\metadata\core-properties\a47c8b1328f541fc8a5cd4c0446d5fe1.psmdcp {version} %named_version_Integration_Wcf%
%compress% "%CD%\Releases\temp" "%CD%\Releases\v%named_version%\SimpleInjector.Integration.Wcf.QuickStart.%named_version_Integration_Wcf%.zip"
rmdir Releases\temp /s /q
mkdir Releases\temp
%xcopy% %nugetTemplatePath%\.NET\SimpleInjector.Integration.WebApi Releases\temp /E /H
%attrib% -r "%CD%\Releases\temp\*.*" /s /d
del Releases\temp\.gitignore /s /q
copy SimpleInjector.Integration.WebApi\bin\Release\net45\SimpleInjector.Integration.WebApi.dll Releases\temp\lib\net45\SimpleInjector.Integration.WebApi.dll
copy SimpleInjector.Integration.WebApi\bin\Release\net45\SimpleInjector.Integration.WebApi.xml Releases\temp\lib\net45\SimpleInjector.Integration.WebApi.xml
%replace% /source:Releases\temp\SimpleInjector.Integration.WebApi.nuspec {version} %named_version_Integration_WebApi%
%replace% /source:Releases\temp\SimpleInjector.Integration.WebApi.nuspec {versionCore} %named_version_Core%
%replace% /source:Releases\temp\SimpleInjector.Integration.WebApi.nuspec {year} %copyrightYear%
%replace% /source:Releases\temp\package\services\metadata\core-properties\a3b1f940a1584e868b3266ff38ba4e08.psmdcp {version} %named_version_Integration_WebApi%
%compress% "%CD%\Releases\temp" "%CD%\Releases\v%named_version%\SimpleInjector.Integration.WebApi.%named_version_Integration_WebApi%.zip"
rmdir Releases\temp /s /q
mkdir Releases\temp
%xcopy% %nugetTemplatePath%\.NET\SimpleInjector.Integration.WebApi.WebHost.QuickStart Releases\temp /E /H
%attrib% -r "%CD%\Releases\temp\*.*" /s /d
del Releases\temp\.gitignore /s /q
%replace% /source:Releases\temp\SimpleInjector.Integration.WebApi.WebHost.QuickStart.nuspec {version} %named_version_Integration_WebApi%
%replace% /source:Releases\temp\SimpleInjector.Integration.WebApi.WebHost.QuickStart.nuspec {versionCore} %named_version_Core%
%replace% /source:Releases\temp\SimpleInjector.Integration.WebApi.WebHost.QuickStart.nuspec {version_Integration_WebApi} %named_version_Integration_WebApi%
%replace% /source:Releases\temp\SimpleInjector.Integration.WebApi.WebHost.QuickStart.nuspec {year} %copyrightYear%
%replace% /source:Releases\temp\package\services\metadata\core-properties\28cf0010982e4a44bd982823a7b4b6be.psmdcp {version} %named_version_Integration_WebApi%
%compress% "%CD%\Releases\temp" "%CD%\Releases\v%named_version%\SimpleInjector.Integration.WebApi.WebHost.QuickStart.%named_version_Integration_WebApi%.zip"
rmdir Releases\temp /s /q
ren "%CD%\Releases\v%named_version%\*.zip" "*.nupkg"
rem We need to reaplce the version number of the core library from 'named_version_Core >= version' to 'named_version_Core >= version < 5'
rem from the following .nupkg files, because ReferenceGenerator does not allow setting a version range of a dependency.
set coreLibraryNupkgDependencySearch="<dependency id=""SimpleInjector"" version=""%named_version_Core%"""
set coreLibraryNupkgDependencyReplace="<dependency id=""SimpleInjector"" version=""[%named_version_Core%,%nextMajorVersion%)"""
copy "SimpleInjector.DynamicAssemblyCompilation\bin\Release\SimpleInjector.DynamicAssemblyCompilation.%named_version_DynamicAssemblyCompilation%.nupkg" Releases\v%named_version%\
%zipreplace% /zipSource:Releases\v%named_version%\SimpleInjector.DynamicAssemblyCompilation.%named_version_DynamicAssemblyCompilation%.nupkg /sourceFile:SimpleInjector.DynamicAssemblyCompilation.nuspec /search:%coreLibraryNupkgDependencySearch% /replace:%coreLibraryNupkgDependencyReplace% /force
echo Please run step 5
goto :EOF
)
IF %step%==5 (
echo Running step 5: RESTORING VERSION NUMBERS
%replace% /line "<VersionPrefix>" " <VersionPrefix>5.0.0</VersionPrefix>" /source:SimpleInjector\SimpleInjector.csproj
%replace% /line "<VersionPrefix>" " <VersionPrefix>5.0.0</VersionPrefix>" /source:SimpleInjector.DynamicAssemblyCompilation\SimpleInjector.DynamicAssemblyCompilation.csproj
%replace% /line "<VersionPrefix>" " <VersionPrefix>5.0.0</VersionPrefix>" /source:SimpleInjector.Integration.Wcf\SimpleInjector.Integration.Wcf.csproj
%replace% /line "<VersionPrefix>" " <VersionPrefix>5.0.0</VersionPrefix>" /source:SimpleInjector.Integration.Web\SimpleInjector.Integration.Web.csproj
%replace% /line "<VersionPrefix>" " <VersionPrefix>5.0.0</VersionPrefix>" /source:SimpleInjector.Integration.Web.Mvc\SimpleInjector.Integration.Web.Mvc.csproj
%replace% /line "<VersionPrefix>" " <VersionPrefix>5.0.0</VersionPrefix>" /source:SimpleInjector.Integration.WebApi\SimpleInjector.Integration.WebApi.csproj
%replace% /line "<VersionPrefix>" " <VersionPrefix>5.0.0</VersionPrefix>" /source:SimpleInjector.Packaging\SimpleInjector.Packaging.csproj
echo Done!
GOTO :EOF
)
echo Unknown step number %step%.
GOTO :EOF
:release_directory_already_exists
echo The release directory v%named_version% already exists.
GOTO :EOF
:strong_name_key_missing
echo The strong name key SimpleInjector.snk does not exist. You should generate (a fake) one for this build script to work or copy fake.snk to SimpleInjector.snk to get things running.
GOTO :EOF
:msbuild_exe_missing
echo Couldn't locate MSBuild.exe. Expected it to be here: %msbuild%
GOTO :EOF
:vsvars32_bat_missing
echo Couldn't locate vsvars32.bat. Expected it to be here: %vsvars32_bat%
GOTO :EOF
:xcopy_missing
echo Couldn't locate xcopy. Expected it to be here: %xcopy%
GOTO :EOF
:referenceLibraryPath_missing
echo The directory %cd%\%referenceLibraryPath% does not exist.
GOTO :EOF