First of all, hope you and the family are keeping well and safe, it has been a while.
Today I bring something that has been puzzling me for the past couple of hours. Here I was working on some PCF controls for my session at the Virtual NetCoreConf 2020 (https://www.youtube.com/watch?v=vX1B_1OOO2Q&t=7s) when I started getting this issue with MsBuild.
This is a new computer so I thought I might have forgotten to install something. I did some research online and it seemed that I needed to install the build tools, which is a bit strange since I am one of those that adds everything when installing Visual Studio. Anyway, so I downloaded the Build tools for 2019 and reinstalled everything hoping for the best but NOPE, same issue, build was nowhere to be found.
I then reached out to my good friend Eickhel Mendoza (@Eickhel) who I know has an immense amount of tips and tricks, more on that very soon stay tuned to his twitter account.
Eickhel mentioned that it is important to double check that the correct tools get installed.
So back again to the Visual Studio installer, switched to Individual components and to my surprise I had the correct tools installed.
What was going on?
9 out of 10 we end up forgetting about the simple things, our beloved terminal checks the Environment Variable called PATH to search for commands, and for some inexplicable reason MSBuild likes to play hide and seek with every user. The build tools can be installed with .NET or with Visual Studio or even individually as seen above, the fact is the location where it gets installed is super random!
So, what do we need to do to fix it? Well we just need to modify the PATH variable, to find it we need to go to:
- Control Panel
- Advanced System settings
- Edit the PATH variable, and include the new path.
Hope it helps! Watch out for more content on PCFs soon!