-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
56 lines (39 loc) · 2.05 KB
/
Copy pathDirectory.Build.props
File metadata and controls
56 lines (39 loc) · 2.05 KB
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
<Project>
<!-- Compute minutes since Jan 1 of the current year -->
<PropertyGroup>
<!-- Current UTC time -->
<Now>$([System.DateTime]::UtcNow)</Now>
<!-- Extract year as integer -->
<CurrentYear>$([System.DateTime]::Parse('$(Now)').Year)</CurrentYear>
<!-- Construct Jan 1 of the current year -->
<StartOfYear>$([System.DateTime]::Parse('$(CurrentYear)-01-01T00:00:00Z'))</StartOfYear>
<!-- Compute the TimeSpan between now and Jan 1 -->
<Span>$([System.DateTime]::Parse('$(Now)').Subtract($([System.DateTime]::Parse('$(StartOfYear)'))))</Span>
<!-- Extract total hours (MSBuild-safe) -->
<HoursSinceYearStart>$([System.Int64]::Parse($([System.TimeSpan]::Parse('$(Span)').TotalHours.ToString("0"))))</HoursSinceYearStart>
</PropertyGroup>
<!-- Apply versioning -->
<PropertyGroup>
<!-- Visible version -->
<Version>2.0.$(HoursSinceYearStart)</Version>
<PackageVersion>2.0.$(HoursSinceYearStart)</PackageVersion>
<AssemblyVersion>2.0.$(HoursSinceYearStart).1</AssemblyVersion>
<FileVersion>2.0.1.$(HoursSinceYearStart)</FileVersion>
<PackOutputFolder>$(ProjectName)\bin\Release</PackOutputFolder>
<PackRelease>True</PackRelease>
</PropertyGroup>
<Target Name="CopyBuildOutputToReleases" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<BuildOutputFiles Include="$(OutputPath)\*.*" />
<ReleaseCopyOutputPath Include="F:\Released\$(ProjectName)" />
</ItemGroup>
<MakeDir Directories="@(ReleaseCopyOutputPath)" />
<Copy SourceFiles="@(BuildOutputFiles)" DestinationFolder="@(ReleaseCopyOutputPath)" SkipUnchangedFiles="false" />
<Message Text="build output copied to @(ReleaseCopyOutputPath)" Importance="High" />
</Target>
<Target Name="ReleasePackageToNuGet" AfterTargets="Pack" Condition="'$(Configuration)' == 'Release'">
<!-- <Exec Command="dotnet nuget push $(PackOutputFolder)\*.nupkg -source nuget.org" /> -->
<Message Text="Package pushed to NuGet.org" Importance="High" />
<Exec Command="dotnet nuget push $(PackOutputFolder)\*.nupkg --source local" />
</Target>
</Project>