I have found a tool that requires me to compile it with Visual Studio. I am not sure if I can do it without the risk of malicious software being installed during the compiling process. Is that possible? Or would only the resulting exe file be malicious?
From compiling C# code manually with the compiler, it would take an exploit in the compiler to do more than produce object files and error messages... Not impossible, but not likely either.
However, if you use a Visual Studio project file, a Makefile or any other build tool, you should very carefully review it as they all can execute arbitrary commands, so infecting you with a virus or worse is relatively easy.