@@ -93164,6 +93164,13 @@ class DotnetInstallScript {
93164
93164
this.scriptArguments.push(...args);
93165
93165
return this;
93166
93166
}
93167
+ useInstallPath(installPath) {
93168
+ if (installPath == null) {
93169
+ installPath = DotnetInstallDir.dirPath;
93170
+ }
93171
+ this.useArguments(utils_1.IS_WINDOWS ? '-Install-Dir' : '--install-dir', installPath);
93172
+ return this;
93173
+ }
93167
93174
useVersion(dotnetVersion, quality) {
93168
93175
if (dotnetVersion.type) {
93169
93176
this.useArguments(dotnetVersion.type, dotnetVersion.value);
@@ -93189,6 +93196,15 @@ class DotnetInstallScript {
93189
93196
}
93190
93197
exports.DotnetInstallScript = DotnetInstallScript;
93191
93198
class DotnetInstallDir {
93199
+ static getInstallDirectory() {
93200
+ if (process.env['DOTNET_INSTALL_DIR'] != null) {
93201
+ return process.env['DOTNET_INSTALL_DIR'];
93202
+ }
93203
+ if (process.env['RUNNER_TOOL_CACHE'] != null) {
93204
+ return path_1.default.join(process.env['RUNNER_TOOL_CACHE'], 'dotnet');
93205
+ }
93206
+ return DotnetInstallDir.default[utils_1.PLATFORM];
93207
+ }
93192
93208
static convertInstallPathToAbsolute(installDir) {
93193
93209
if (path_1.default.isAbsolute(installDir))
93194
93210
return path_1.default.normalize(installDir);
@@ -93211,9 +93227,7 @@ DotnetInstallDir.default = {
93211
93227
mac: path_1.default.join(process.env['HOME'] + '', '.dotnet'),
93212
93228
windows: path_1.default.join(process.env['PROGRAMFILES'] + '', 'dotnet')
93213
93229
};
93214
- DotnetInstallDir.dirPath = process.env['DOTNET_INSTALL_DIR']
93215
- ? DotnetInstallDir.convertInstallPathToAbsolute(process.env['DOTNET_INSTALL_DIR'])
93216
- : DotnetInstallDir.default[utils_1.PLATFORM];
93230
+ DotnetInstallDir.dirPath = DotnetInstallDir.convertInstallPathToAbsolute(DotnetInstallDir.getInstallDirectory());
93217
93231
class DotnetCoreInstaller {
93218
93232
constructor(version, quality) {
93219
93233
this.version = version;
@@ -93234,6 +93248,8 @@ class DotnetCoreInstaller {
93234
93248
.useArguments(utils_1.IS_WINDOWS ? '-Runtime' : '--runtime', 'dotnet')
93235
93249
// Use latest stable version
93236
93250
.useArguments(utils_1.IS_WINDOWS ? '-Channel' : '--channel', 'LTS')
93251
+ // Explicitly set the install path (see https://github.com/actions/setup-dotnet/issues/360)
93252
+ .useInstallPath(DotnetInstallDir.dirPath)
93237
93253
.execute();
93238
93254
if (runtimeInstallOutput.exitCode) {
93239
93255
/**
@@ -93251,6 +93267,8 @@ class DotnetCoreInstaller {
93251
93267
.useArguments(utils_1.IS_WINDOWS ? '-SkipNonVersionedFiles' : '--skip-non-versioned-files')
93252
93268
// Use version provided by user
93253
93269
.useVersion(dotnetVersion, this.quality)
93270
+ // Explicitly set the install path (see https://github.com/actions/setup-dotnet/issues/360)
93271
+ .useInstallPath(DotnetInstallDir.dirPath)
93254
93272
.execute();
93255
93273
if (dotnetInstallOutput.exitCode) {
93256
93274
throw new Error(`Failed to install dotnet, exit code: ${dotnetInstallOutput.exitCode}. ${dotnetInstallOutput.stderr}`);
0 commit comments