1
1
<?xml version =" 1.0" encoding =" utf-8" ?>
2
- <Project ToolsVersion =" 12.0" DefaultTargets =" UnitTest" xmlns =" http://schemas.microsoft.com/developer/msbuild/2003" >
2
+ <Project ToolsVersion =" 12.0" DefaultTargets =" PackageScriptHost; UnitTest" xmlns =" http://schemas.microsoft.com/developer/msbuild/2003" >
3
3
<PropertyGroup >
4
4
<BuildInParallel Condition =" '$(BuildInParallel)' == ''" >true</BuildInParallel >
5
5
<NuGetExe >tools\NuGet.exe</NuGetExe >
6
6
<SkipStrongNamesExe >packages\Microsoft.Web.SkipStrongNames.1.0.0\tools\SkipStrongNames.exe</SkipStrongNamesExe >
7
7
<SkipStrongNamesXml >tools\SkipStrongNames.xml</SkipStrongNamesXml >
8
8
<PublishPath Condition =" '$(PublishPath)' == '' " >bin</PublishPath >
9
+ <Configuration Condition =" '$(Configuration)' == '' " >Release</Configuration >
9
10
<SetConfiguration Condition =" '$(Configuration)' != '' " >Configuration=$(Configuration)</SetConfiguration >
10
11
<SetPlatform Condition =" '$(Platform)' != '' " >Platform=$(Platform)</SetPlatform >
11
12
</PropertyGroup >
80
81
<MSBuild Projects =" @(Binplace)"
81
82
BuildInParallel =" $(BuildInParallel)" />
82
83
</Target >
84
+
85
+ <Target Name =" PackageScriptHost" DependsOnTargets =" Build" >
86
+ <PropertyGroup >
87
+ <ScriptHostOutput >.\src\WebJobs.Script.Host\bin\$(Configuration)</ScriptHostOutput >
88
+ </PropertyGroup >
89
+ <ItemGroup >
90
+ <ScriptHostBinaries Include =" $(ScriptHostOutput)\*.dll;$(ScriptHostOutput)\*.exe*" />
91
+ <EdgeJsFiles Include =" $(ScriptHostOutput)\edge\**\*.*" />
92
+ </ItemGroup >
93
+ <Copy SourceFiles =" @(ScriptHostBinaries)" DestinationFolder =" $(PublishPath)\Binaries\WebJobs.Script.Host" />
94
+ <Copy SourceFiles =" @(EdgeJsFiles)" DestinationFiles =" @(EdgeJsFiles->'$(PublishPath)\Binaries\WebJobs.Script.Host\edge\%(RecursiveDir)%(Filename)%(Extension)')" />
95
+ <Zip
96
+ InputPath=" $(PublishPath)\Binaries\WebJobs.Script.Host"
97
+ OutputFileName=" $(PublishPath)\Packages\WebJobs.Script.Host.zip"
98
+ OverwriteExistingFile=" true"
99
+ />
100
+ </Target >
83
101
84
102
<UsingTask TaskName =" Xunit.Runner.MSBuild.xunit" AssemblyFile =" packages\xunit.MSBuild.2.0.0.0\tools\xunit.runner.msbuild.dll" />
85
103
189
207
</Code >
190
208
</Task >
191
209
</UsingTask >
210
+
211
+ <UsingTask TaskName =" Zip" TaskFactory =" CodeTaskFactory" AssemblyFile =" $(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll" >
212
+ <ParameterGroup >
213
+ <InputPath ParameterType =" System.String" Required =" true" />
214
+ <OutputFileName ParameterType =" System.String" Required =" true" />
215
+ <OverwriteExistingFile ParameterType =" System.Boolean" Required =" false" />
216
+ </ParameterGroup >
217
+ <Task >
218
+ <Reference Include =" System.IO.Compression" />
219
+ <Using Namespace =" System.IO.Compression" />
220
+ <Code Type =" Fragment" Language =" cs" >
221
+ <![CDATA[
222
+ const int BufferSize = 64 * 1024;
223
+
224
+ var buffer = new byte[BufferSize];
225
+ var fileMode = OverwriteExistingFile ? FileMode.Create : FileMode.CreateNew;
226
+
227
+ string[] InputFileNames = Directory.GetFiles(InputPath, "*.*", SearchOption.AllDirectories);
228
+
229
+ using (var outputFileStream = new FileStream(OutputFileName, fileMode))
230
+ {
231
+ using (var archive = new ZipArchive(outputFileStream, ZipArchiveMode.Create))
232
+ {
233
+ foreach (var inputFileName in InputFileNames)
234
+ {
235
+ string relativeFileName = inputFileName.Substring(InputPath.Length + 1);
236
+ var archiveEntry = archive.CreateEntry(relativeFileName);
237
+
238
+ using (var fs = new FileStream(inputFileName, FileMode.Open))
239
+ {
240
+ using (var zipStream = archiveEntry.Open())
241
+ {
242
+ int bytesRead = -1;
243
+ while ((bytesRead = fs.Read(buffer, 0, BufferSize)) > 0)
244
+ {
245
+ zipStream.Write(buffer, 0, bytesRead);
246
+ }
247
+ }
248
+ }
249
+ }
250
+ }
251
+ }
252
+ ]]>
253
+ </Code >
254
+ </Task >
255
+ </UsingTask >
256
+
192
257
</Project >
0 commit comments