My ultimate goal is to able to use Visual Studio Code to write and run simple C++ programs. I have installed Visual Studio Code and MSBuild (Visual Studio Build Tools 2017) on my machine.
I do not have Visual Studio IDE installed on my machine. So, I have no easy way to create *.vcproj and *.sln for the code that I write.
So, here is what I do: I write a simple C++ program and save the file as test.cpp. And then, even before creating a build task in VS code, I wanted to verify if MSBuild works. So, I ran the following command.
msbuild.exe /t:ClCompile /p:SelectedFiles="test.cpp"
and it returns the following error:
error MSB1003: Specify a project or solution file. The current working
directory does not contain a project or solution file.
Is it possible to use MSBuild to compile a single C++ file?
Reference: Using MSBuild to compile a single cpp file - This page suggest that I should be able to run MSBuild to compile a single C++ file since VS 2010.