MSBuild: What is it, and when do I need it?

前端 未结 5 1133
野趣味
野趣味 2020-12-08 04:47

I seem to have missed Day 1 of MsBuild 101. I find myself asking \"What does it do, what does it replace, and when do I need it?\" since I can just hit F5 and compile my a

5条回答
  •  北海茫月
    2020-12-08 05:06

    MSBuild is the build platform that enables all build activity in the Visual Studio world.

    A better, more practical example would be to state that

    1. The .csproj files (every C# project) are msbuild files

    2. When you hit F5, you basically (oversimplifying) call msbuild.exe and passing in your .csproj file.

    MSBuild empowers all the things that make hitting F5 work. From creating the "debug" or "release" folder, to dropping references into the bin\ directory, to invoking CSC ... and everything in between ... MSBuild "powers" all that.

    If all you will ever need from a build is the output that F5 gives you, then you know about all you probably need to know about MSBuild.

    In most commercial/practical development scenarios, however, there will come a time where there is a need to customize the build process. The most common approach is automating the build process (using either TeamBuild or some homegrown system). You may also need to

    • create a "packaged" deployment
    • link to another library outside of your project that is also actively being developed
    • publish your build to an FTP and send an email to a customer notifying them of its availability.

    The use of a unified and extensible build platform (ie MSBuild) is what makes all these these possible, while still being part of the build process ... keeping the "build" part of the development pipeline simple and contained.

提交回复
热议问题