-
Notifications
You must be signed in to change notification settings - Fork 0
/
Directory.Build.targets
38 lines (34 loc) · 1.61 KB
/
Directory.Build.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
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Push the target package to nuget
-->
<Target Name="PushPackage" AfterTargets="Pack"
Condition="'$(PushAfterPack)'=='true' AND '$(IsPackable)'=='true'">
<Exec Command="dotnet nuget push $(SolutionDir)output/$(PackageId).$(PackageVersion).nupkg $(PackageSourceParam) $(PackageApiKeyParam)"></Exec>
</Target>
<!--
Set the package version and source before Pack
https://github.com/NuGet/NuGet.Client/blob/4.3.0.4202/src/NuGet.Core/NuGet.Build.Tasks.Pack.Library/Pack.targets
Must run before target "GenerateNuspec" ("Pack") for the version to be applied as expected
-->
<Target Name="SetPackageVersion" BeforeTargets="GenerateNuspec"
Condition="'$(IsPackable)'=='true'">
<PropertyGroup>
<VersionPrefix>$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionPrefix>
<PackageVersion Condition="'$(VersionSuffix)'==''">$(VersionPrefix)</PackageVersion>
<PackageVersion Condition="'$(VersionSuffix)'!=''">$(VersionPrefix)-$(VersionSuffix)</PackageVersion>
</PropertyGroup>
</Target>
<Target Name="SetPackageSource" BeforeTargets="GenerateNuspec"
Condition="'$(PushAfterPack)'=='true'">
<PropertyGroup>
<PackageSourceParam Condition="'$(PackageSource)'!=''">--source $(PackageSource)</PackageSourceParam>
</PropertyGroup>
</Target>
<Target Name="SetPackageApiKey" BeforeTargets="GenerateNuspec"
Condition="'$(PushAfterPack)'=='true'">
<PropertyGroup>
<PackageApiKeyParam Condition="'$(PackageApiKey)'!=''">--api-key $(PackageApiKey)</PackageApiKeyParam>
</PropertyGroup>
</Target>
</Project>