Extreme ASP.NET Makeover: Getting Your House in Order - Inspecting a Proj File

Play Extreme ASP.NET Makeover: Getting Your House in Order - Inspecting a Proj File
Sign in to queue


Creating an Automated Build Script

In creating a build script, we want to automate common tasks for building the project source code as much as possible. Whether you know it or not, you are already using build scripts. When you create a new project, Visual Studio creates a build script for that project in the form of a .csproj or .vbproj file. (MSBuild was introduced with .NET Framework 2.0, so project files created by Visual Studio 2005 and above use the new MSBuild format under the covers.) If you open a project file in a text editor such as Notepad rather than Visual Studio, you will see something like this clip.

To run a build from the command line, simply launch a Visual Studio 2008 Command Prompt, navigate to the solution root, and execute:


msbuild ScrewTurnWiki.sln


Running the Visual Studio 2008 Command Prompt instead of the standard command prompt ensures that the Visual Studio and the .NET Framework directories are added to the PATH environment variable, enabling you to execute commands like msbuild.exe without specifying the full path to the executable. In addition to compiling the entire solution, you can compile individual projects.


msbuild src\app\Core\Core.csproj


Rather than editing the project files directly, I will create a separate build file for building the solution from the command line. If you are creating a custom build file, the two most commonly used build engines on the .NET platform are MSBuild and NAnt. (Other options include rake, Bake, and psake, among others.) I will use MSBuild since it is installed by default with .NET Framework 2.0 and above.


Other videos from this article

·         Overview

·         Source control

·         Inspecting a project file

·         Building from the command line


Read the full article at  https://msdn.microsoft.com/en-us/magazine/dd758790.aspx



Download this episode

The Discussion

Add Your 2 Cents