Search code examples
c#msbuild

MSBuild vs compiler


What is the difference between using MSBuild and the C# compiler from a command prompt? I want to manually build my solutions/projects without using Visual Studio and I want to learn how to use the command line tools.


Solution

  • By C# compiler do you mean csc.exe?

    If that is what you mean, then csc and MSBuild are completely different applications.

    MSBuild uses a solution and project files to build the files in your project. MSBuild uses csc.exe as its actual compiler but knows where to find assemblies, references etc based on your solution and project files (these files are actually xml files).

    When using csc.exe you must manually provide paths to your files, references and so on, thus making your compilation much more difficult.

    MSDN MSBuild: http://msdn.microsoft.com/en-us/library/dd393574.aspx

    MSDN CSC : http://msdn.microsoft.com/en-us/library/78f4aasd.aspx