Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bash: msbuild: command not found

Having a problem with adding msbuild to git bash for Win10

already added msbuild to system vars and to path too

CMD msbuild calls fine

already tried this solution

Git bash msbuild

Path system var

like image 413
keipa Avatar asked Apr 14 '17 08:04

keipa


People also ask

How do I enable MSBuild?

To enable msbuild in Command Prompt, you simply have to add the directory of the msbuild.exe install on your machine to the PATH environment variable. You can access the environment variables by: Right clicking on Computer. Click Properties.

How do I install MSBuild?

To install MSBuild on a system that doesn't have Visual Studio, go to Build Tools for Visual Studio 2019, or install the . NET SDK. If you have Visual Studio, then you already have MSBuild installed. With Visual Studio 2022, it's installed under the Visual Studio installation folder.

How do I run MSBuild manually?

To run MSBuild at a command prompt, pass a project file to MSBuild.exe, together with the appropriate command-line options. Command-line options let you set properties, execute specific targets, and set other options that control the build process.

How do I add MSBuild exe to path?

Click on System and Security and then on System. In the left pane, click on Advanced system settings. At the very bottom of the pop up, click on Environment Variables. Edit the Path variable and append the folder's path that contains the MSBuild.exe to it (e.g., ;C:\Windows\Microsoft.NET\Framework64\v4.


2 Answers

Use msbuild.exe in Git Bash instead of msbuild.

like image 132
gpresland Avatar answered Oct 31 '22 15:10

gpresland


If you want to refer to an environment variable you need to prefix it with $, like $msbuild. I'm not sure that is the best idea though, nor modifying the system path: what if you have different versions of msbuild?

Anyway, your real problem is that the command isn't msbuild, it is MSBuild.exe. And a convenient way of adding it to the mingw environment is making sure it is already in the path before starting bash. For example, create a batch file 'msbuild-git-bash.bat' in the same directory as git-bash.bat, containing

call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\VsDevCmd.bat"
git-bash.bat

then use that instead and type msbu and hit tab to get command completion:

enter image description here

Note this example is for VS2013, for other versions the path to vsdevcmd.bat will be different but the principle is the same. Also because of using it, nmake/cl/link/... are also all available.

like image 31
stijn Avatar answered Oct 31 '22 15:10

stijn