First, you need to get the latest msbuild.
You can get it from Visual Studio 2017 download page. On the bottom, click “Other Tools and Frameworks”, then choose “Build Tools for Visual Studio 2017”.
Direct download link
Start that setup file (vs_buildtools_xxx.exe), and choose “Web Development Build Tools”.
After installing, you will get a new command prompt in the start menu, called “Developer Command Prompt for VS 2017”. Use it to start your command prompt, as it will add to path all required folders to run msbuild from anywhere.
Go to your folder with your solution sln file, and just type msbuild. It will automatically start building the sln files.
If you use nuget packages, you will get errors about missing packages. You may have read somewhere that you only need to type “msbuild /t:restore”, but I think that it’s only works for .NET Core solutions, it does nothing for Studio 2017 classic framework projects.
Now you need an additional file: nuget.exe,
I use the latest version, 4.1. The download is not a setup, it’s directly the nuget executable. Only 1 file is needed.
I suggest to save it somewhere available in your path from DOS, maybe at the same place that msbuild was installed, [C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin].
Now, get back to your sln folder, and just type “nuget restore”. The “packages” folder will be created, and required nuget packages downloaded there.
You’re ready to try msbuild again.