diff --git a/Tasks/UseDotNetV2/Strings/resources.resjson/en-US/resources.resjson b/Tasks/UseDotNetV2/Strings/resources.resjson/en-US/resources.resjson index 484a7694c67f..525a90a6b2d6 100644 --- a/Tasks/UseDotNetV2/Strings/resources.resjson/en-US/resources.resjson +++ b/Tasks/UseDotNetV2/Strings/resources.resjson/en-US/resources.resjson @@ -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." -} \ No newline at end of file + "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." +} diff --git a/Tasks/UseDotNetV2/task.json b/Tasks/UseDotNetV2/task.json index 2b8a2a99c343..bb170a355287 100644 --- a/Tasks/UseDotNetV2/task.json +++ b/Tasks/UseDotNetV2/task.json @@ -13,7 +13,7 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 191, + "Minor": 195, "Patch": 0 }, "satisfies": [ @@ -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." } -} \ No newline at end of file +} diff --git a/Tasks/UseDotNetV2/task.loc.json b/Tasks/UseDotNetV2/task.loc.json index c5bab768295e..c00bd64225ce 100644 --- a/Tasks/UseDotNetV2/task.loc.json +++ b/Tasks/UseDotNetV2/task.loc.json @@ -13,7 +13,7 @@ "author": "Microsoft Corporation", "version": { "Major": 2, - "Minor": 191, + "Minor": 195, "Patch": 0 }, "satisfies": [ @@ -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" } -} \ No newline at end of file +} diff --git a/Tasks/UseDotNetV2/usedotnet.ts b/Tasks/UseDotNetV2/usedotnet.ts index 27f4a593fd17..0675b4ddfe6e 100644 --- a/Tasks/UseDotNetV2/usedotnet.ts +++ b/Tasks/UseDotNetV2/usedotnet.ts @@ -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();; @@ -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 @@ -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) { @@ -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.");