Visual Studio not installed; this is necessary for Windows development
Asked Answered
A

11

48

My Flutter Doctor is saying:

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.

Flutter doctor

How can I fix this problem?

Articulator answered 11/2, 2022 at 12:59 Comment(3)
So do what it says?Legit
the vs code already installed that's why I'm confusedArticulator
It's not VSCode. It's Visual Studio.Wycoff
N
58

It's basically saying that if you want to develop your Flutter application for Windows you will need to install Visual Studio 2022 and while installing Visual Studio 2022 you will need to download this: Desktop development with C++

Also, you have to install the third link in this: Visual-studio

You could also get desktop development with the C++ tool after installing Visual Studio and then navigating to tool → Get tools and featuresDesktop development with C++.

Enter image description here

Nepotism answered 11/2, 2022 at 14:26 Comment(5)
Is visual studio for windows necessary if I want to build or run my flutter app? It seems unnecessary for mobile developmentPaisa
Yes, for mobile app development its not necessary, but for windows app development its necessaryNepotism
if VS is not necessary for mobile android apps develop on windows then how can avoid it, but I want to write code in VS code.Ably
Visual Studio and Visual studio code are different, if you want to write Flutter code you can use Visual studio code, If you want to develop Windows apps using Flutter you will need to install a specific tool from Visual Studio and then just write code in Visual studio code.Nepotism
The error can be ignored if you do not want to develop Windows applications using Flutter.Implosive
R
51

Is unnecessary to install the "Desktop development with C++" if you don't want to develop desktop applications for Windows using Flutter.

If you only want to develop mobile apps using Flutter, you can run

flutter config --no-enable-windows-desktop

to disable the desktop support for your Flutter projects. After that, when you run the flutter doctor command again, you will no longer see the warning.

Read more at: https://fig.io/manual/flutter/config

Residuum answered 5/2, 2023 at 11:4 Comment(4)
This should have way more upvotes! I don't think most developers want to create a Windows app anyways, this should be way more promoted.Variegated
Flutter documentation itself starts with Mobile-First development. They should ask during setup whether user wants to develop for Mobile or DevelopMonmouth
This is the best answerTruthvalue
This is the correct answer. I faced the same issues and after executing flutter config --no-enable-windows-desktop issues was resolved.Hebetate
O
18

The error means install Visual Studio, and this is different from Visual Studio Code. It's an IDE from Microsoft.

For those who may be using a weak computer and can't afford to install the full Visual Studio, you only need to install a few components from Visual Studio to get Flutter to run on your computer without errors. These components are:

  1. MSVC v142 - Visual Studio 2022 C++ x64/86 build tools.
  2. Windows 10 SDK (for Windows 10 users)
  3. C++ CMake tools for Windows.

In total, they should occupy around 8 GB or so.

Ooze answered 26/2, 2022 at 11:45 Comment(3)
Visual Studio 2022 itself is version 17.x.x, e.g. 17.3.4.Phenazine
Do they have to go on C:\ or is D:\ ok?Capricorn
And for those who don't want to waste time/disk space installing MSVS if they don't need it, then run Flutter doctor with flutter config --no-enable-windows-desktop, then re-run flutter doctor.Supremacy
W
10

As it states, you need to download Visual Studio (which is different from Visual Studio Code).

When installing it, remember to select the required package Desktop development with C++:

Screenshot

This will not prevent you from developing Mobile apps, but it's a requirement only for Windows Development.

Wycoff answered 11/2, 2022 at 13:9 Comment(0)
E
6

To build Windows application (exe file), you don't need install Visual Studio IDE. You can only install Visual Studio Build Tools.

When installing it, remember to select the required package Desktop development with C++ similar when install Visual Studio IDE.

Refer

Elkeelkhound answered 17/3, 2023 at 23:25 Comment(0)
R
1

Also You Install the Visual Studio Desktop development with C++

You could also get desktop development with the C++ tool after installing Visual Studio and then navigating to tool → Get tools and features → Desktop development with C++.

enter image description here

Runstadler answered 17/6 at 11:17 Comment(0)
S
0

Only two steps are required.

  1. Install Visual Studio 2022 (Link: https://visualstudio.microsoft.com/downloads/)

  2. Install Visual Studio Code (Link: https://code.visualstudio.com/)

Your code will run smoothly.

Sinegold answered 31/10, 2022 at 6:48 Comment(1)
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From ReviewBayne
C
0

My solution was a bit simpler. Uninstall everything all build system's from VS. Then reinstall Visual Studio Community 2022, restart then try again. Might get a warning about nuget but it should fix the issue.

Calisaya answered 16/1, 2023 at 3:7 Comment(0)
B
0

With the newest android installer "android-studio-2022.1.1.19-windows" there would be a jbr and jre folder existing, hence creating a link from jre to jbr would not work.

What you can do is copy the contents of the items in jbr into the jre folder and this would resolve the error.

Brayer answered 18/1, 2023 at 4:13 Comment(0)
C
0

I even had already installed VS2022 and encountered this error.

I had to add this line to graalvm-jdk-21.0.1+12.1\bin\native-image.bat

@echo off

call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" > nul
Crespo answered 23/11, 2023 at 21:36 Comment(0)
K
-3
  1. Make sure to install Visual Studio Code.

  2. Open the Visual Studio download page:

    Enter image description here

Klemperer answered 17/4, 2022 at 17:15 Comment(1)
Visual Studio Code is not the same as Visual Studio. Though it may be the gist of the question. But the confusion should not be in answers.Phenazine

© 2022 - 2024 — McMap. All rights reserved.