Skip to content

Commit a5bd493

Browse files
committed
Merge remote-tracking branch 'gittools/master'
2 parents be73192 + d8dc1ab commit a5bd493

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed
+14-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
# MyGet
2-
// TODO Feel free to jump in and contribute
2+
3+
MyGet Build Services has built-in support for GitVersion and is encouraging you to leverage GitVersion + GitFlow to produce Semantically Versioned packages.
4+
5+
* Create a [custom build script](http://docs.myget.org/docs/reference/custom-build-scripts): we advise to run a tool like GitVersion in a *pre-build* script, so that it can set additional environment variables for the actual build script. MyGet [by convention](http://docs.myget.org/docs/reference/build-services#Pre-_and_post-build_steps) automatically picks up any of the following file names as pre-build script:
6+
* `pre-build.(bat|cmd|ps1)`
7+
* `pre-myget.(bat|cmd|ps1)`
8+
* Run `GitVersion /output buildserver`: this will cause MyGet Build Services to set the current `%PackageVersion%` value to the NuGet-compatible SemVer generated by GitVersion and apply this [MyGet Environment Variable](http://docs.myget.org/docs/reference/build-services#Available_Environment_Variables) wherever it is used during the build process.
9+
* Ensure the build script has been pushed to your source repository root. Done :)
10+
11+
Note: If you require the `AssemblyInfo.cs` files in your project to be patched with the information from GitVersion, you will have to run it manually, for example using the command:
12+
13+
`call %GitVersion% /updateassemblyinfo true`.
14+
15+
Also check [docs.myget.org](http://docs.myget.org/docs/reference/build-services#GitVersion_and_Semantic_Versioning) for the latest full info.
+8-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,15 @@
1-
using System;
2-
using System.IO;
1+
using System.IO;
2+
using System.Linq;
33

44
public static class DirectoryDateFinder
55
{
66
public static long GetLastDirectoryWrite(string path)
77
{
8-
var lastHigh = DateTime.MinValue;
9-
foreach (var file in Directory.EnumerateDirectories(path, "*.*", SearchOption.AllDirectories))
10-
{
11-
var lastWriteTime = File.GetLastWriteTime(file);
12-
if (lastWriteTime > lastHigh)
13-
{
14-
lastHigh = lastWriteTime;
15-
}
16-
}
17-
return lastHigh.Ticks;
8+
return new DirectoryInfo(path)
9+
.GetDirectories("*.*", SearchOption.AllDirectories)
10+
.Select(d => d.LastWriteTimeUtc)
11+
.DefaultIfEmpty()
12+
.Max()
13+
.Ticks;
1814
}
1915
}

0 commit comments

Comments
 (0)