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

4 changes: 2 additions & 2 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 @@ -189,4 +189,4 @@
"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."
}
}
}
4 changes: 2 additions & 2 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 @@ -189,4 +189,4 @@
"OnlyExplicitVersionAllowed": "ms-resource:loc.messages.OnlyExplicitVersionAllowed",
"SupportPhaseNotPresentInChannel": "ms-resource:loc.messages.SupportPhaseNotPresentInChannel"
}
}
}
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(`NET Core version you specfied (${versionSpec}) 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.`);
AnnaOpareva marked this conversation as resolved.
Show resolved Hide resolved
}
}

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