Update default .NET installation for Linux (#20521)

* Update default .NET installation for Linux

* Fix error

* Address comments
This commit is contained in:
Sakshi Sharma
2022-09-01 10:29:14 -07:00
committed by GitHub
parent a8a235bded
commit 5e8ebe2340
2 changed files with 24 additions and 12 deletions

View File

@@ -9,9 +9,8 @@ import * as fs from 'fs';
import * as path from 'path';
import * as vscode from 'vscode';
import * as sinon from 'sinon';
import { NetCoreTool, DBProjectConfigurationKey, DotnetInstallLocationKey, NetCoreNonWindowsDefaultPath } from '../tools/netcoreTool';
import { NetCoreTool, DBProjectConfigurationKey, DotnetInstallLocationKey } from '../tools/netcoreTool';
import { getQuotedPath } from '../common/utils';
import { isNullOrUndefined } from 'util';
import { generateTestFolderPath } from './testUtils';
import { createContext, TestContext } from './testContext';
@@ -48,14 +47,20 @@ describe('NetCoreTool: Net core tests', function (): void {
if (os.platform() === 'win32') {
// check that path should start with c:\program files
let result = isNullOrUndefined(netcoreTool.netcoreInstallLocation) || netcoreTool.netcoreInstallLocation.toLowerCase().startsWith('c:\\program files');
should(result).true('dotnet is either not present or in programfiles by default');
let result = !netcoreTool.netcoreInstallLocation || netcoreTool.netcoreInstallLocation.toLowerCase().startsWith('c:\\program files');
should(result).true('dotnet not present in programfiles by default');
}
if (os.platform() === 'linux' || os.platform() === 'darwin') {
if (os.platform() === 'linux'){
//check that path should start with /usr/share
let result = !netcoreTool.netcoreInstallLocation || netcoreTool.netcoreInstallLocation.toLowerCase() === '/usr/share/dotnet';
should(result).true('dotnet not present in /usr/share');
}
if (os.platform() === 'darwin') {
//check that path should start with /usr/local/share
let result = isNullOrUndefined(netcoreTool.netcoreInstallLocation) || netcoreTool.netcoreInstallLocation.toLowerCase().startsWith(NetCoreNonWindowsDefaultPath);
should(result).true('dotnet is either not present or in /usr/local/share by default');
let result = !netcoreTool.netcoreInstallLocation || netcoreTool.netcoreInstallLocation.toLowerCase() === '/usr/local/share/dotnet';
should(result).true('dotnet not present in /usr/local/share');
}
});