microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
1.11.2

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/extension/services/validationService/checks/dotnet.ts

43lines · modepreview

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for details.

import * as nls from "vscode-nls";
import { createNotFoundMessage, createVersionErrorMessage, executeCommand } from "../util";
import { IValidation, ValidationCategoryE, ValidationResultT } from "./types";

nls.config({
    messageFormat: nls.MessageFormat.bundle,
    bundleFormat: nls.BundleFormat.standalone,
})();
const toLocale = nls.loadMessageBundle();

const label = ".NET Core 3.1";

async function test(): Promise<ValidationResultT> {
    const command = "dotnet --info";
    const data = await executeCommand(command);
    if (data.stdout) {
        if (data.stdout.includes("Microsoft.NETCore.App 3.1"))
            return {
                status: "success",
            };
        return {
            status: "failure",
            comment: createVersionErrorMessage(label),
        };
    }
    return {
        status: "failure",
        comment: createNotFoundMessage(label),
    };
}

const main: IValidation = {
    label,
    platform: ["win32"],
    description: toLocale("DotNetTestDescription", "Required for building RNW apps"),
    category: ValidationCategoryE.Windows,
    exec: test,
};

export default main;