Skip to content

Commit

Permalink
Merge pull request #2 from bogdangaliceanu/version-file-path
Browse files Browse the repository at this point in the history
Read version file path from config if available
  • Loading branch information
hinteadan authored Mar 2, 2017
2 parents 0801067 + bd020dc commit 03827b1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions H.Versioning/H.Versioning/H.Versioning.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using System;
using System.Configuration;
using System.IO;

namespace H.Versioning.VersionProviders
{
internal sealed class TheOneVersionProvider : VersionProviderPipeline
{
private static readonly string versionFile = ConfigurationManager.AppSettings["H.Versioning.VersionFile"] ?? "version.txt";

public TheOneVersionProvider()
: base(
Pipe(() => File.Exists("version.txt"), new FileVersionProvider("version.txt")),
Pipe(() => File.Exists(versionFile), new FileVersionProvider(versionFile)),
Pipe(() => true, new GitVersionProvider(AppDomain.CurrentDomain.BaseDirectory))
)
{ }
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ H.Versioning.Version.Self.GetCurrent().ToString()

then the library will parse the version from there.

Alternatively, you can specify the full path of the file in a config entry with the key ```H.Versioning.VersionFile```.


This is usefull when you deploy the app and therefore don't have access to the GIT repo.

Expand Down

0 comments on commit 03827b1

Please sign in to comment.