This post originated from an RSS feed registered with .NET Buzz
by Raymond Lewallen.
Original Post: Using Devenv at the command prompt to build projects
Feed Title: Raymond Lewallen
Feed URL: /error.htm?aspxerrorpath=/blogs/raymond.lewallen/rss.aspx
Feed Description: Patterns and Practices, OOP, .Net and Sql
We all know about NAnt, MsBuild and some other build tools.
People are very aware of these, but seem to be unaware that you can
create your own build batch file just by using visual studio and the
command prompt.
Letâs say you have 2 solutions, a solution with business objects and
business rules assemblies, and another solution just for an Asp.Net GUI
project. We can easily build a batch file to compile these three
projects:
Voila! Run the batch file to build everything in debug build.
âDevenvâ is the IDE executable.
/build is the switch to build the project. It takes either
âdebugâ or âreleaseâ as arguments. Change âdebugâ to âreleaseâ to
build everything in release mode.
/project and its argument specifiy the name of the project to build within a solution.
The final argument for âdevenvâ is the location of the solution file that contains the project you want to build.
Note: This works for .Net IDE 2002 and 2003. I have not
tried this with 2005 yet. If anyone has, let me know of the
changes in the comments below.
You can do âdevenv /?â at the command prompt to list all available switches for Devenv, with descriptions of their uses.
From MSDN Documentation:
The following syntax rules apply to all switches and arguments:
The command line syntax must start with devenv. For example, to use the /fn switch you would type the following:
devenv /fn arial
Switches are not case sensitive.
The first argument is typically a solution file name.
When you supply a project file name instead of a solution file name, Devenv does the following:
Searches the parent directory of the project file for a solution
file of the same name. For example, if you specify myproject1.vbproj,
Devenv looks for myproject1.sln.
Searches for a single solution file with a reference to the project
file in the parent directory of the project file. If more than one
solution references the project file or no solutions reference the
project file, a temporary solution with the same name as the project
file is created.
File paths and file names that include spaces must be enclosed in double quotation mark ("").
Include the drive letter when specifying file paths.
Separate multiple switches and arguments with one white space character.
Devenv does not accept wildcards or other pattern matching syntax.
Use the following command line switches to display the integrated development environment and perform the described task.
Opens the IDE in multiple-document interface (MDI)
mode. In addition, the MDI environment option in the Options dialog box
is selected. For more information, see General, Environment, Options Dialog Box.
Opens the IDE and copies certain Options dialog box settings from a pervious version to the more recent version.
/debugexe
Loads a Visual C++ executable under the control of the
debugger. This switch is not available for Visual Basic or Visual C#
executables. For more information, see Launching the Debugger Automatically.
/useenv
Causes the integrated development environment (IDE) to
use PATH, INCLUDE, and LIB environment variables for Visual C++
compilation rather than the settings specified in the VC++ Directories
section of Projects options in the Options dialog box. For more
information, see Setting the Path and Environment Variables for Command-Line Builds
Use the following command line switches to perform the described
task. These command line switches do not display the integrated
development environment.