@@ -15,14 +15,15 @@ public partial class CLITestBase : TestContainer
15
15
private const string TestAssetsFolder = "TestAssets" ;
16
16
private const string PackagesFolder = "packages" ;
17
17
private const string EngineeringFolder = "eng" ;
18
+ private const string ArtifactsFolder = "artifacts" ;
18
19
19
20
// This value is automatically updated by "build.ps1" script.
20
21
private const string TestPlatformCLIPackageName = "Microsoft.TestPlatform" ;
21
22
private const string VstestConsoleRelativePath = @"tools\net462\Common7\IDE\Extensions\TestPlatform\vstest.console.exe" ;
22
23
23
24
protected XmlDocument ReadVersionProps ( )
24
25
{
25
- var versionPropsFilePath = Path . Combine ( Environment . CurrentDirectory , EngineeringFolder , "Versions.props" ) ;
26
+ var versionPropsFilePath = Path . Combine ( GetRepositoryRootFolder ( ) , EngineeringFolder , "Versions.props" ) ;
26
27
using var fileStream = File . OpenRead ( versionPropsFilePath ) ;
27
28
using var xmlTextReader = new XmlTextReader ( fileStream ) { Namespaces = false } ;
28
29
var versionPropsXml = new XmlDocument ( ) ;
@@ -39,18 +40,18 @@ protected string GetTestPlatformVersion()
39
40
return testSdkVersion . InnerText ;
40
41
}
41
42
42
- protected string GetArtifactsFolder ( )
43
+ protected string GetRepositoryRootFolder ( )
43
44
{
44
45
var assemblyLocation = System . Reflection . Assembly . GetExecutingAssembly ( ) . Location ;
45
46
46
- return Path . Combine ( assemblyLocation , @"..\..\..\.." ) ;
47
+ return Path . Combine ( assemblyLocation , @"..\..\..\..\.. " ) ;
47
48
}
48
49
49
50
/// <summary>
50
51
/// Gets the path of test assets folder.
51
52
/// </summary>
52
53
/// <returns>Path to testassets folder.</returns>
53
- protected string GetAssetFolderPath ( ) => Path . Combine ( GetArtifactsFolder ( ) , TestAssetsFolder ) ;
54
+ protected string GetAssetFolderPath ( ) => Path . Combine ( GetRepositoryRootFolder ( ) , ArtifactsFolder , TestAssetsFolder ) ;
54
55
55
56
/// <summary>
56
57
/// Gets the full path to a test asset.
@@ -75,7 +76,7 @@ protected string GetAssetFullPath(string assetName)
75
76
76
77
protected string GetTestAdapterPath ( )
77
78
{
78
- var testAdapterPath = Path . Combine ( GetArtifactsFolder ( ) , TestAssetsFolder ) ;
79
+ var testAdapterPath = Path . Combine ( GetRepositoryRootFolder ( ) , ArtifactsFolder , TestAssetsFolder ) ;
79
80
return testAdapterPath ;
80
81
}
81
82
0 commit comments