Allow DOTNET_ROOT to be based on an actual file
Check if DOTNET_ROOT isn't already set, if not base the value on the location of the actual dotnet file, symlinked or not.
This commit is contained in:
@@ -94,8 +94,10 @@ export class DotnetTool implements IDotnetTool {
|
||||
//
|
||||
this.buildAgent.debug(`toolPath: ${toolPath}`);
|
||||
|
||||
if (os.platform() !== "win32") {
|
||||
const dotnetRoot = path.dirname(fs.readlinkSync(await this.buildAgent.which("dotnet")));
|
||||
if (os.platform() !== "win32" && !this.buildAgent.getVariable("DOTNET_ROOT")) {
|
||||
let dotnetPath = await this.buildAgent.which("dotnet");
|
||||
dotnetPath = fs.readlinkSync(dotnetPath) || dotnetPath;
|
||||
const dotnetRoot = path.dirname(dotnetPath);
|
||||
this.buildAgent.exportVariable("DOTNET_ROOT", dotnetRoot);
|
||||
}
|
||||
this.buildAgent.addPath(toolPath);
|
||||
@@ -148,4 +150,4 @@ export class DotnetTool implements IDotnetTool {
|
||||
|
||||
return await this.buildAgent.cacheDir(tempDirectory, toolName, version);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user