microsoft/vscode-react-native
Publicmirrored from https://github.com/microsoft/vscode-react-nativeAvailable
src/extension/services/validationService/checks/dotnet.ts
43lines · modeblame
62af5fc4Samriel4 years ago | 1 | // Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | // Licensed under the MIT license. See LICENSE file in the project root for details. | |
| 3 | | |
| 4 | import * as nls from "vscode-nls"; | |
| 5 | import { createNotFoundMessage, createVersionErrorMessage, executeCommand } from "../util"; | |
| 6 | import { IValidation, ValidationCategoryE, ValidationResultT } from "./types"; | |
| 7 | | |
| 8 | nls.config({ | |
| 9 | messageFormat: nls.MessageFormat.bundle, | |
| 10 | bundleFormat: nls.BundleFormat.standalone, | |
| 11 | })(); | |
| 12 | const toLocale = nls.loadMessageBundle(); | |
| 13 | | |
| 14 | const label = ".NET Core 3.1"; | |
| 15 | | |
| 16 | async function test(): Promise<ValidationResultT> { | |
| 17 | const command = "dotnet --info"; | |
| 18 | const data = await executeCommand(command); | |
| 19 | if (data.stdout) { | |
| 20 | if (data.stdout.includes("Microsoft.NETCore.App 3.1")) | |
| 21 | return { | |
| 22 | status: "success", | |
| 23 | }; | |
| 24 | return { | |
| 25 | status: "failure", | |
| 26 | comment: createVersionErrorMessage(label), | |
| 27 | }; | |
| 28 | } | |
| 29 | return { | |
| 30 | status: "failure", | |
| 31 | comment: createNotFoundMessage(label), | |
| 32 | }; | |
| 33 | } | |
| 34 | | |
| 35 | const main: IValidation = { | |
| 36 | label, | |
| 37 | platform: ["win32"], | |
| 38 | description: toLocale("DotNetTestDescription", "Required for building RNW apps"), | |
| 39 | category: ValidationCategoryE.Windows, | |
| 40 | exec: test, | |
| 41 | }; | |
| 42 | | |
| 43 | export default main; |