|
Navigation: Samples > Visual Studio > VStudio.bld Sample |
![]() ![]()
|
This sample demonstrates an entire build process that uses Microsoft Visual Studio 6.0 and Visual Studio .NET (2002, 2003, and/or 2005). It creates and uses a sample SourceSafe project if VSS is installed.
The build recursively gets the latest source files, checks out the executable files, registers the components, builds several Visual Studio projects, checks in the updated executables, and labels the SourceSafe project with a build number (after prompting the user for the number). Custom actions are used to build the projects, which will prevent unnecessary rebuilds, increment versions when building, set project base addresses, etc.
If any step fails, the failure steps are executed, which send an e-mail with the error output from the failed step. You may need to update the e-mail address and modify the server settings. The SMTP_SERVER, TO_EMAIL, and FROM_EMAIL project macros should be updated to appropriate values, and a username and password assigned to the Send Mail steps if necessary.
The first time the project is built, all the projects are built; if built again (close and reopen the project or reset the build status and build), VisBuildPro detects that they are up-to-date and none of the projects get built (with the exception of C# and VB.NET 2002/2003, since Visual Studio .NET always compiles the executable for these projects even if they are up-to-date). If the project is rebuilt, all projects will be cleaned and rebuilt (achieved by using the Builder.LaunchType property in a field override for the force build checkboxes in the Make VB6, Make VC6 and Make VS.NET steps).
Note: On systems where the TEMP path is a long filename, building the web application project in the VS.NET solution may fail; this occurs only because the sample builds in the TEMP folder, whose value is provided as a short filename, and VS.NET thinks the virtual directory path is different than the project file's path (because it does an [invalid] comparison of a short filename to a long filename) and treats it as an error condition. As long as you avoid performing your builds in the TEMP path (or change your TEMP path to something like c:\Temp) this won't be a problem for real builds. Another option for more robust automated builds of web applications is to avoid VS.NET web projects altogether: http://www.pluralsight.com/fritz/Samples/aspdotnet_without_web_projects.htm.
Several standard system macros are used, such as PROJDIR, to generically determine the file locations, FAILSTEP_OUTPUT to show the error message from a previous step, DOSCMD to execute operating system commands, DATETIME to log the current date/time. A LOGFILE project macro is also defined to log all build output to VStudio.log in a temporary directory.
Note: This sample project is located in the Visual Studio subfolder of the Samples path.