Skip to content

Commit 75b4e2b

Browse files
committed
Fixes GitTools#1278 - ContinuaCI use environment variable not registry.
1 parent 120d8b6 commit 75b4e2b

File tree

1 file changed

+6
-26
lines changed

1 file changed

+6
-26
lines changed
Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,16 @@
11
namespace GitVersion
22
{
3-
#if NETDESKTOP
4-
using Microsoft.Win32;
3+
using System;
54

65
public class ContinuaCi : BuildServerBase
76
{
8-
public override bool CanApplyToCurrentContext()
9-
{
10-
const string KeyName = @"Software\VSoft Technologies\Continua CI Agent";
117

12-
if (RegistryKeyExists(KeyName, RegistryView.Registry32))
13-
{
14-
return true;
15-
}
8+
public const string EnvironmentVariableName = "ContinuaCI.Version";
169

17-
if (RegistryKeyExists(KeyName, RegistryView.Registry64))
18-
{
19-
return true;
20-
}
10+
public override bool CanApplyToCurrentContext()
11+
{
12+
return !string.IsNullOrEmpty(Environment.GetEnvironmentVariable(EnvironmentVariableName));
2113

22-
return false;
2314
}
2415

2516
public override string[] GenerateSetParameterMessage(string name, string value)
@@ -33,17 +24,6 @@ public override string[] GenerateSetParameterMessage(string name, string value)
3324
public override string GenerateSetVersionMessage(VersionVariables variables)
3425
{
3526
return string.Format("@@continua[setBuildVersion value='{0}']", variables.FullSemVer);
36-
}
37-
38-
static bool RegistryKeyExists(string keyName, RegistryView registryView)
39-
{
40-
var localKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, registryView);
41-
localKey = localKey.OpenSubKey(keyName);
42-
43-
return localKey != null;
44-
}
27+
}
4528
}
46-
47-
#endif
48-
4929
}

0 commit comments

Comments
 (0)