Ahmed Trabelsi
Ahmed Trabelsi

Reputation: 581

Visual Studio not installed; this is necessary for Windows development

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?

Upvotes: 53

Views: 195652

Answers (12)

Roscoe - ROSCODE
Roscoe - ROSCODE

Reputation: 39

You need to install Visual Studio. This is different to Visual Studio Code.

https://visualstudio.microsoft.com/downloads/

Ensure that you select 'Desktop development with C++' and probably 'Mobile development with C++'

Upvotes: 0

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

Upvotes: 1

Đức Hải Trần
Đức Hải Trần

Reputation: 135

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

Upvotes: 6

itstata
itstata

Reputation: 1168

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

Upvotes: 0

Denis Francia Karell
Denis Francia Karell

Reputation: 783

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

Upvotes: 62

edmund chan kei yun
edmund chan kei yun

Reputation: 121

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.

Upvotes: 0

exts
exts

Reputation: 9851

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.

Upvotes: 0

Nipun Dexter
Nipun Dexter

Reputation: 11

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.

Upvotes: 0

Daniel Don
Daniel Don

Reputation: 379

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.

Upvotes: 18

Sreerag Sree
Sreerag Sree

Reputation: 11

  1. Make sure to install Visual Studio Code.

  2. Open the Visual Studio download page:

    Enter image description here

Upvotes: -2

Rohith Nambiar
Rohith Nambiar

Reputation: 3720

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

Upvotes: 63

Dani3le_
Dani3le_

Reputation: 1487

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.

Upvotes: 10

Related Questions