34

Iam trying to create and run a flutter desktop application in visual studio 2019 ,i have downloaded the files required(MSBuild and MSVC) and still getting error. i was having 2013 versio and uninstalled it and installed 2019 version and all is updated

this happen when i run flutter run command

Launching lib\main.dart on Windows in debug mode...
Unable to find suitable Visual Studio toolchain. Please run `flutter doctor` for more details.

and when i run flutter doctor gives me that error

[!] Visual Studio - develop for Windows (Visual Studio Community 2019 16.4.5)
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop
      development with C++" workload, and include these components:
        MSBuild
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        Windows 10 SDK (10.0.17763.0)

Any solution !

ADev
  • 669
  • 3
  • 11
  • 17

10 Answers10

23

Install the Desktop Development with C++

Install the Desktop Development with

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
16

I received this error when I forgot to change the 'Device to use' from the default 'Windows' to Chrome. This can happen after restarting Visual Studio Code. To resolve:

  1. Click on the bottom right of the screen where it says 'Windows'
  2. Select 'Chrome' (or whatever device you're developing for).

device selection

Marc Stogaitis
  • 789
  • 5
  • 6
15
  1. Go to visual studio installer
  2. Click on modify
  3. Then click on individual component
  4. And select the exact version of Windows 10 SDK as shown in flutter doctor.

In my case, by default visual studio installer, installed Windows 10 SDK (10.0.18362.0) but Flutter required Windows 10 SDK (10.0.17763.0).

Just get the exact version of components as shown.

Alok Kumar
  • 397
  • 1
  • 4
  • 15
8

If you are getting that error message, then according to Visual Studio you are missing at least one of the necessary components in that list. The most likely issue is that you didn't install the exact version of the Windows 10 SDK that's listed there, which is not included by default on the latest version.

(Edit: The exact SDK version requirement mentioned above was accurate at the time this answer was originally written, but does not apply to current versions of Flutter.)

smorgan
  • 20,228
  • 3
  • 47
  • 55
6

You might have not installed Visual Studio.

Download it from here https://visualstudio.microsoft.com/downloads/

if already installed then run the setup again and make sure that Desktop development with C++ workload, including all of its default components is installed.

Visual Studio Installer Screen


Restart the IDE, and run the app.
arbaz diwan
  • 79
  • 1
  • 2
6

This might occur when you are not installed Visual Studio on your machine.

  • If Visual Studio is not there then download and install it. While installing you ensure that the VS 2019 build tools, Windows SDK and CMake are selected.

    Download Visual Studio

enter image description here

  • If already installed then run the setup again and make sure that Desktop development with C++ workload, including all of its default components is installed.

For more: Fixing issues with Flutter on Windows

Codemaker2015
  • 12,190
  • 6
  • 97
  • 81
1

I also got this exact error when I was building a mobile application. Seems like I hadn't selected the device for output. I selected an emulator for output and now the code is running. Just 2 clicks and now the error is solved. No installation or whatever.

  • The only way to get the `Unable to find suitable Visual Studio toolchain` error message is to attempt to build for Windows. It has nothing to do with Android or iOS application development. – smorgan Oct 03 '21 at 21:32
1

This error occurred to me in vs code I when you forgot to select the device output for the emulator. Once I selected it worked without any downloads [1] survey to the bottom left of tour vs code editor named Windows(windows-x64) [2] select the device your preferred device and click

0

You are missing the "Desktop development with c++" https://code.visualstudio.com/docs/cpp/config-msvc follow this to install that. This worked for me

0
  1. Go down on this link and select checkbox c++ and install

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

  3. Reinstall visual studio

Sarthak Raval
  • 1,001
  • 1
  • 10
  • 23