未安装 Visual Studio;这对于 Windows 开发是必要的

Ahm*_*lsi 45 visual-studio dart flutter

我的颤振医生说:

Visual Studio - develop for Windows

X Visual Studio not installed; this is necessary for Windows development.
  Download at https://visualstudio.microsoft.com/downloads/.
  Please install the "Desktop development with C++" workload, including all 
  of its default components.
Run Code Online (Sandbox Code Playgroud)

扑医生

我该如何解决这个问题?

Roh*_*iar 54

基本上是说,如果您想为 Windows 开发 Flutter 应用程序,则需要安装 Visual Studio 2022,在安装 Visual Studio 2022 时,您需要下载:使用 C++ 进行桌面开发

\n

另外,您必须安装其中的第三个链接:Visual-studio

\n

安装 Visual\xc2\xa0Studio 后,您还可以使用 C++ 工具进行桌面开发,然后导航到工具 \xe2\x86\x92获取工具和功能\xe2\x86\x92使用 C++ 进行桌面开发

\n

在此输入图像描述

\n

  • 如果您不想使用Flutter开发Windows应用程序,则可以忽略该错误。 (14认同)
  • 是的,对于移动应用程序开发来说,这不是必需的,但对于 Windows 应用程序开发来说,这是必要的 (11认同)
  • 如果我想构建或运行我的 flutter 应用程序,是否需要 Visual Studio for Windows?对于移动开发来说似乎没有必要 (3认同)
  • 如果VS对于在Windows上开发的移动Android应用程序来说不是必需的那么如何避免它,但我想在VS代码中编写代码。 (2认同)

Den*_*ell 40

如果您不想使用Flutter开发Windows桌面应用程序,则无需安装“C++桌面开发”。

如果您只想使用 Flutter 开发移动应用程序,您可以运行

flutter config --no-enable-windows-desktop

禁用对 Flutter 项目的桌面支持。之后,当您flutter doctor再次运行该命令时,您将不再看到该警告。

了解更多信息:https: //fig.io/manual/flutter/config

  • 这应该有更多的赞成票!我认为大多数开发人员无论如何都不想创建 Windows 应用程序,这应该得到更多的推广。 (5认同)

Dan*_*Don 15

该错误表示安装 Visual Studio,这与 Visual Studio Code 不同。它是 Microsoft 的 IDE。

\n

对于那些可能使用较弱的计算机并且无法安装完整的 Visual Studio 的人来说,您只需要安装 Visual\xc2\xa0Studio 中的一些组件即可让 Flutter 在您的计算机上运行而不会出现错误。这些组件是:

\n
    \n
  1. MSVC v142 - Visual Studio 2022 C++ x64/86 构建工具。
  2. \n
  3. Windows 10 SDK(适用于 Windows 10 用户)
  4. \n
  5. 适用于 Windows 的C++ CMake工具。
  6. \n
\n

它们总共应占用大约 8 GB 左右。

\n


Dan*_*le_ 10

正如它所述,您需要下载Visual Studio(与 Visual Studio Code 不同)。

安装时,记得选择所需的包Desktop development with C++

截屏

这不会阻止您开发移动应用程序,但这只是Windows 开发的要求。


Đức*_*rần 5

要构建 Windows 应用程序(exe 文件),您不需要安装 Visual Studio IDE。您只能安装Visual Studio Build Tools

安装时,记得选择所需的包Desktopdevelopment with C++,类似于安装Visual Studio IDE时。

参考