Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deprecation message for net core 2.1 #15389

Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@
"loc.messages.VersionNumberHasTheWrongFormat": "The version number: %s doesn't have the correct format. Versions can be given in the following formats: 2.x => Install latest in major version. 2.2.x => Install latest in major and minor version. 2.2.104 => Install exact version. Find the value of `version` for installing SDK/Runtime, from the releases.json. The link to releases.json of that major.minor version can be found in [**releases-index file.**](https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json). Like link to releases.json for 2.2 version is https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.2/releases.json",
"loc.messages.OnlyExplicitVersionAllowed": "Only explicit versions and accepted, such as: 2.2.301. Version: %s is not valid.",
"loc.messages.SupportPhaseNotPresentInChannel": "support-phase is not present in the channel with channel-version %s."
}
"loc.messages.DepricatedVersionNetCore": "NET Core version you specfied %s is out of support and will be removed from hosted agents soon. Please refer to https://aka.ms/dotnet-core-support for more information about the .NET support policy."
}
7 changes: 4 additions & 3 deletions Tasks/UseDotNetV2/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 191,
"Minor": 195,
"Patch": 0
},
"satisfies": [
Expand Down Expand Up @@ -187,6 +187,7 @@
"FailedToReadGlobalJson": "The global.json at path: '%s' has the wrong format. For information about global.json, visit here: https://docs.microsoft.com/en-us/dotnet/core/tools/global-json. Error while trying to read: %s",
"VersionNumberHasTheWrongFormat": "The version number: %s doesn't have the correct format. Versions can be given in the following formats: 2.x => Install latest in major version. 2.2.x => Install latest in major and minor version. 2.2.104 => Install exact version. Find the value of `version` for installing SDK/Runtime, from the releases.json. The link to releases.json of that major.minor version can be found in [**releases-index file.**](https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/releases-index.json). Like link to releases.json for 2.2 version is https://dotnetcli.blob.core.windows.net/dotnet/release-metadata/2.2/releases.json",
"OnlyExplicitVersionAllowed": "Only explicit versions and accepted, such as: 2.2.301. Version: %s is not valid.",
"SupportPhaseNotPresentInChannel": "support-phase is not present in the channel with channel-version %s."
"SupportPhaseNotPresentInChannel": "support-phase is not present in the channel with channel-version %s.",
"DepricatedVersionNetCore": "NET Core version you specfied %s is out of support and will be removed from hosted agents soon. Please refer to https://aka.ms/dotnet-core-support for more information about the .NET support policy."
}
}
}
7 changes: 4 additions & 3 deletions Tasks/UseDotNetV2/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 2,
"Minor": 191,
"Minor": 195,
"Patch": 0
},
"satisfies": [
Expand Down Expand Up @@ -187,6 +187,7 @@
"FailedToReadGlobalJson": "ms-resource:loc.messages.FailedToReadGlobalJson",
"VersionNumberHasTheWrongFormat": "ms-resource:loc.messages.VersionNumberHasTheWrongFormat",
"OnlyExplicitVersionAllowed": "ms-resource:loc.messages.OnlyExplicitVersionAllowed",
"SupportPhaseNotPresentInChannel": "ms-resource:loc.messages.SupportPhaseNotPresentInChannel"
"SupportPhaseNotPresentInChannel": "ms-resource:loc.messages.SupportPhaseNotPresentInChannel",
"DepricatedVersionNetCore": "ms-resource:loc.messages.DepricatedVersionNetCore"
}
}
}
12 changes: 12 additions & 0 deletions Tasks/UseDotNetV2/usedotnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ import { VersionInfo, VersionParts } from "./models"
import { NuGetInstaller } from "./nugetinstaller";
import { error } from 'util';


function checkVersionForDeprecationAndNotify(versionSpec: string | null): void {
if (versionSpec != null && versionSpec.startsWith("2.1")) {
tl.warning(tl.loc('DepricatedVersionNetCore',versionSpec));
}
}

async function run() {
let useGlobalJson: boolean = tl.getBoolInput('useGlobalJson');
let packageType = (tl.getInput('packageType') || "sdk").toLowerCase();;
Expand All @@ -34,6 +41,7 @@ async function run() {
// By default disable Multi Level Lookup unless user wants it enabled.
tl.setVariable("DOTNET_MULTILEVEL_LOOKUP", !performMultiLevelLookup ? "0" : "1");
}

// Add dot net tools path to "PATH" environment variables, so that tools can be used directly.
addDotNetCoreToolPath();
// Install NuGet version specified by user or 4.4.1 in case none is specified
Expand Down Expand Up @@ -70,6 +78,8 @@ async function installDotNet(
let url = versionFetcher.getDownloadUrl(version);
if (!dotNetCoreInstaller.isVersionInstalled(version.getVersion())) {
await dotNetCoreInstaller.downloadAndInstall(version, url);
} else {
checkVersionForDeprecationAndNotify(versionSpec);
}
}
} else if (versionSpec) {
Expand All @@ -82,6 +92,8 @@ async function installDotNet(
}
if (!dotNetCoreInstaller.isVersionInstalled(versionInfo.getVersion())) {
await dotNetCoreInstaller.downloadAndInstall(versionInfo, versionFetcher.getDownloadUrl(versionInfo));
} else {
checkVersionForDeprecationAndNotify(versionSpec);
}
} else {
throw new error("Hey developer you have called the method `installDotNet` without a `versionSpec` or without `useGlobalJson`. that is impossible.");
Expand Down