How to resolve msbuild is not recognized as internal or external command error in visual studio code

I have working a lot recently with visual studio code and why not. I am into Power platform and with power platform developer extensions focused more on client side technologies, I association with visual studio code shall be for long.

And whenever I develop PCF Controls, I am on this platform. Where you are an expert in something and have done something many a times, you frequently tend to overlook some areas which you haven’t thought about ever.

I realized that when one of my blog readers reported he is getting the error while using msbuild command and building his PCF control using Visual studio code. It just always works for me and I never thought that if someone get stuck in that step.

I am from Dynamics 365 and Power platform background and I keep my posts related to it. But if your are here with the issue but belong to a different technology, you shall find the blog equally useful.

Precisely, below scenario resolutions are discussed in this blog.

  • You get an error – “msbuild is not recognized as internal or external command” while executing msbuild command from your regular command prompt
  • You get an error – “msbuild is not recognized as internal or external command” while executing msbuild command from Visual studio code.
msbuild is not recognized as internal or external command

Please follow the below steps to resolve this.

  1. Navigate to your computer properties
msbuild is not recognized as internal or external command

2. Click on Advanced system settings.

msbuild is not recognized as internal or external command

3. Click of Environment variables button

msbuild is not recognized as internal or external command

4. Add the msbuild.exe file to the path variable

msbuild is not recognized as internal or external command

msbuild is not recognized as internal or external command

Path for visual studio 2017

%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin

Path for Visual studio 2019

%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin

All required steps are now done. Make sure to reopen your command prompt or visual studio code terminal. Now if you run msbuild command, it should work fine.

P.S – You do not need to perform these steps if working with Developer command prompt for Visual studio.

Hope this small tip helped! Looking for your next great Dynamics 365 jobs? Find Microsoft Dynamics 365 jobs on Jooble

You can find tons of useful information in my blog to deal with Dynamics 365 or Power platform.

Also, if you are faced with a really challenging situation, you can seek the assistance of Dynamics 365 Consultants who can save you plenty of time by getting to the roots of the problem and fixing it faster.

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading