-
Notifications
You must be signed in to change notification settings - Fork 0
/
Build.proj
71 lines (57 loc) · 3.39 KB
/
Build.proj
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
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- Define base directory of the solution -->
<SolutionDir>$(MSBuildProjectDirectory)\</SolutionDir>
<!-- Version to build -->
<Version>1.0.0</Version>
<!-- The NuGet tool -->
<NuGet>build\NuGet\nuget.exe</NuGet>
<!-- Configuration/Platform and intermediate OutputPath option for .NET library compilation -->
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<Platform Condition="'$(Platform)' == ''">AnyCPU</Platform>
<OutputPath>bin\$(Configuration)</OutputPath>
<!-- Define where to put the NuGet package -->
<OutDir>$(SolutionDir)Drop\$(Configuration)\$(Platform)\</OutDir>
<NuGetPackageLocalSource>C:\Projects\MyLocalNuGetPackagesForTest\</NuGetPackageLocalSource>
</PropertyGroup>
<Target Name="Clean">
<RemoveDir Directories="$(SolutionDir)src\PosInformatique.Net.HttpServer\$(OutputPath)" />
<RemoveDir Directories="$(OutDir)" />
</Target>
<Target Name="Build">
<!-- Backup the AssemblyInfo.Version.cs -->
<Copy SourceFiles="$(SolutionDir)AssemblyInfo.Version.cs"
DestinationFiles="$(SolutionDir)AssemblyInfo.Version.bak" />
<!-- Update the AssemblyInfo.Version.cs with the $(Version)-->
<ItemGroup>
<_Lines Include="//-----------------------------------------------------------------------"></_Lines>
<_Lines Include="// <copyright file="AssemblyInfo.Version.cs" company="P.O.S Informatique">"></_Lines>
<_Lines Include="// Copyright (c) P.O.S Informatique. All rights reserved."></_Lines>
<_Lines Include="// </copyright>"></_Lines>
<_Lines Include="//-----------------------------------------------------------------------"></_Lines>
<_Lines Include="[assembly: System.Reflection.AssemblyVersion("$(Version)")]"></_Lines>
</ItemGroup>
<WriteLinesToFile File="$(SolutionDir)AssemblyInfo.Version.cs"
Lines="@(_Lines)"
Overwrite="true" />
<!-- Run the compilation of the library -->
<MSBuild Projects="$(SolutionDir)src\PosInformatique.Net.HttpServer\PosInformatique.Net.HttpServer.csproj"
Properties="Configuration=$(Configuration);Platform=$(Platform);OutputPath=$(OutputPath)"/>
<!-- Restore the backuped AssemblyInfo.Version.cs -->
<Move SourceFiles="$(SolutionDir)AssemblyInfo.Version.bak"
DestinationFiles="$(SolutionDir)AssemblyInfo.Version.cs" />
</Target>
<!-- Packaging for NuGet -->
<Target Name="NuGetPack" DependsOnTargets="Build">
<Exec Command="$(NuGet) pack "$(SolutionDir)PosInformatique.Net.HttpServer.nuspec" -OutputDirectory "$(OutDir)." -Version $(Version)"/>
</Target>
<!-- Publish the NuGet package in local folder for tests -->
<Target Name="PublishLocal" DependsOnTargets="NuGetPack">
<Copy SourceFiles="$(OutDir)PosInformatique.Net.HttpServer.$(Version).nupkg" DestinationFolder="$(NuGetPackageLocalSource)" />
</Target>
<!-- Publish the NuGet package to the nuget.org website -->
<Target Name="Publish" DependsOnTargets="NuGetPack">
<Exec Command="$(NuGet) push "$(OutDir)PosInformatique.Net.HttpServer.$(Version).nupkg" -Source https://www.nuget.org"/>
</Target>
</Project>