-
Notifications
You must be signed in to change notification settings - Fork 2
/
packaging.targets
86 lines (66 loc) · 4.35 KB
/
packaging.targets
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
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
</PropertyGroup>
<!--
NuGet default properties
Can be overwritten with MSBuild parameters (f.e. "... /p:BuildPackageCustom=false ...")
-->
<PropertyGroup>
<!-- use custom nuget package build -->
<BuildPackageCustom Condition="'$(BuildPackageCustom)' == ''">true</BuildPackageCustom>
<!-- publish nuget packages -->
<PublishPackage Condition="'$(PublishPackage)' == ''">true</PublishPackage>
<!-- push to local nuget repository -->
<NugetRepository Condition="'$(NugetRepository)' == ''">C:\nuget_local</NugetRepository>
<!-- prerealse version suffix -->
<PrereleaseVersion Condition="'$(PrereleaseVersion)' == ''"></PrereleaseVersion>
<!-- product version -->
<ProductVersion Condition="'$(ProductVersion)' == ''">Sc90</ProductVersion>
</PropertyGroup>
<!-- get package version from versioning.target, if any -->
<Choose>
<When Condition="'$(PrereleaseVersion)' != ''">
<PropertyGroup>
<NugetPackageVersion>$(PackageVersion)-$(PrereleaseVersion)$([System.String]::Format('{0:000}', $([MSBuild]::Add($(BuildNumber), 0))))</NugetPackageVersion>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<NugetPackageVersion>$(PackageVersion)</NugetPackageVersion>
</PropertyGroup>
</Otherwise>
</Choose>
<PropertyGroup>
<BuildDependsOn>
$(BuildDependsOn);
BuildPackageCustom;
PublishPackage;
</BuildDependsOn>
<NuGetExePath Condition=" '$(NuGetExePath)' == '' ">$(NuGetToolsPath)\NuGet.exe</NuGetExePath>
<NuGetCommand Condition=" '$(OS)' == 'Windows_NT'">"$(NuGetExePath)"</NuGetCommand>
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
<NugetRepository Condition="$(NugetRepository) == ''">C:\nuget_local</NugetRepository>
<_NugetApiKey Condition="'$(NugetApiKey)' != ''"> -ApiKey "$(NugetApiKey)"</_NugetApiKey>
<PackageOutputDir>$([System.IO.Path]::GetDirectoryName('$(ProjectDir)$(IntermediateOutputPath)'))</PackageOutputDir>
<PackageSpec>$(ProjectPath.Replace('.csproj', '.nuspec'))</PackageSpec>
<PackageOutput>$(ProjectName.Replace('.csproj', '')).*$(NugetPackageVersion).nupkg</PackageOutput>
<PackageSymbolsOutput>$(ProjectName.Replace('.csproj', '')).*$(NugetPackageVersion).symbols.nupkg</PackageSymbolsOutput>
<BuildCommandSolution Condition="'$(NugetPackageVersion)' != ''">$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -MSBuildVersion 14 -Symbols -IncludeReferencedProjects -Properties "ProductVersion=$(ProductVersion);DependentVersion=$(NugetPackageVersion)" -Version "$(NugetPackageVersion)"</BuildCommandSolution>
<BuildCommandSolution Condition="'$(NugetPackageVersion)' == ''">$(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -MSBuildVersion 14 -Symbols -IncludeReferencedProjects -Properties "ProductVersion=$(ProductVersion)"</BuildCommandSolution>
<!--<PublishCommand>$(NuGetCommand) push "$(PackageOutputDir)\$(PackageOutput)" $(_NugetApiKey) -source "$(NugetRepository)"</PublishCommand>-->
<PublishSymbolsCommand>$(NuGetCommand) push "$(PackageOutputDir)\$(PackageSymbolsOutput)" $(_NugetApiKey) -source "$(NugetRepository)"</PublishSymbolsCommand>
</PropertyGroup>
<Target Name="PublishPackage" Condition="'$(PublishPackage)' == 'true'">
<!--<Exec Command="$(PublishCommand)" LogStandardErrorAsError="true" />-->
<Exec Command="$(PublishSymbolsCommand)" LogStandardErrorAsError="true" />
</Target>
<Target Name="BuildPackageCustom" Condition="$(BuildPackageCustom) == 'true'">
<Exec Command="$(BuildCommandSolution)" LogStandardErrorAsError="true" />
</Target>
</Project>