|
|
|
|
|
Home
»
VB.NET
»
Build a .NET solution or project from the command line using VB.NET
|
|
|
|
Total page views :
24999
|
|
Total downloads :
107
|
|
|
|
|
Download
Files:
|
|
|
|
|
|
|
|
|
|
|
|
|
Similar ArticlesMost ReadTop RatedLatest
|
|
|
|
|
|
|
|
|
|
Introduction.
I take this opportunity to write about the Command line switches for making our .NET Project Release Builds with out much fuss. The Reason am writing this is that this topic mentioned above is much ignored topic across .NET developers circles. ...
Devenv Command Line Switches.
Devenv allows you to set various options for the integrated development environment (IDE) as well as compile, build, and debug projects from the command line. Use these switches to run the IDE from a script or .bat file, such as a nightly build script, or to launch the IDE in a particular configuration.
Tip To have Visual Studio launch and open a single file automatically in an editor, enter the full path and file name after typing Devenv with no additional switches or arguments. For example, devenv "D:\TestWinApp\testWinApp\testWinApp\ testWinApp.csproj".

Suppose if you give a wrong path of a solution file then the following Error Message will be thrown.

Devenv Switch Syntax.
Switches for Devenv follow syntax rules that are very similar to other DOS command line utilities. Devenv command line switches work for devenv.com and devenv.exe. By default, entering devenv without a file extension passes switches to devenv.com. Using devenv.com provides the correct delivery of output using standard system streams, such as stdout and stderr, and correct I/O redirection for capturing output, such as in a .txt file. To pass switches to devenv.exe, you must specify devenv.exe. All of the syntax rules listed below apply to devenv.com.
Tip The switch /? Displays a list of the available switches in the Command Prompt window for Devenv along with descriptions of their uses.
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.
Devenv Switches.
Use the following command line switches to display the integrated development environment and perform the described task.
|
Command Line |
Switch Description |
| /lcid or /l |
Sets the default language for the IDE. |
| /fn |
Changes the system font for the IDE. |
| /fs |
Changes the system font size for the IDE. |
| /run or /r |
Compiles and runs the specified solution. |
| /runexit |
Compiles and runs the specified solution, minimizing the IDE when the solution is run, and closing the IDE after the solution has completed running. |
| /mdi |
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. |
| /mditabs |
Opens the IDE in MDI mode with the tabs on documents enabled. |
| /command |
Starts the IDE and executes the specified command. |
| /migratesettings |
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.
|
Command Line |
Switch Description |
| /build |
Builds the specified solution or project according to the specified solution configuration. |
| /rebuild |
Cleans and then builds the specified solution or project according to the specified solution configuration. |
| /project |
The project to build, clean, or deploy. You can use this switch only if you have supplied the /build, /rebuild, /clean, or /deploy switch. |
| /projectconfig |
Specifies the project configuration to build or deploy. You can use this switch only if you have supplied the /project switch. |
| /clean |
Cleans the specified solution or project according to the specified solution configuration. |
| /deploy |
Causes deployment after a build (or a rebuild) according to the specified solution configuration. |
| /out |
Allows you to specify a file to receive errors when you build. |
| /nologo |
Prevents copyright information from displaying. |
| /? |
Displays help inside the Command Prompt window for Devenv switches. | The following switches are available only to those companies who participate in the Visual Studio .NET Integration Program (VSIP).
|
Command Line |
Switch Description |
| /noVSIP |
Disables the VSIP developer's license key on a developer workstation. |
| /safemode |
Launches Visual Studio in safe mode, loading only the default environment and services. |
| /resetskippkgs |
Clears all SkipLoading tags added to VSPackages by users wishing to avoid loading problem VSPackages | Let us take a look at Some of switches.
1) /Build -
devenv /build ConfigName [/project ProjName] [/projectconfig ConfigName] SolutionName
Arguments.
ConfigName
Required. The solution configuration name. SolutionName
Required. The path and name of the solution. If you want to build a single project configuration, use the /project ProjName argument to specify which project to build and optionally supply the /projectconfig configandplatformname argument.
/project ProjName
Optional. The project file name, as an absolute path or a relative path from the directory containing the solution file. You can also specify the project display name. Use this argument to build a single project within a solution with multiple projects.
/projectconfig ConfigName
Optional. The name of the build configuration. Remarks.
- This switch is the same as Build Solution (CTRL + SHIFT + B) available within the IDE.
- Paths that include spaces must be enclosed in double quotation marks.
- Summary information for builds, including errors, appears in the Command Prompt window or in any log file specified with the /out argument.
Run the the following command in Visual command Prompt.
devenv /build Debug "<Path-Of-the-Solution-File>"
This Command will build the Solution in the Debug Mode.
Here is the output.

2) /out.
Allows you to specify a file to receive errors when you build using the command line arguments.
devenv /out FileName.
Arguments.
FileName Required. The path and name of the file to receive errors when you build an executable.
Remarks.
- If a file name that does not exist is specified, the file is created automatically. If the file already exists, the contents are deleted before running the current build.
Command line build errors are displayed in the Command Prompt window and the Solution Builder view of the Output window. This option is useful if you are running unattended builds and need to see the results.
devenv /run /out "c:\MyErrorLog.txt" "D:\CUT1.3\POSClient\POSClient.sln"
the output of the command from MyErrorLog.txt which got created under C:\ , Becoz of build problems of PosClient Solution.
------ Build started: Project: POS, Configuration: Debug .NET ------
Preparing resources... Updating references... The dependency 'POSUI' could not be found. The dependency 'Utility' could not be found. The dependency 'ControllerInterface' could not be found. The dependency 'HECUIControls' could not be found. The dependency 'CommonDataEntity' could not be found. Cannot copy assembly 'ProcessController' to file 'D:\CUT1.3\deploymentarea\apps\posclient\ProcessController.dll'. The process cannot access the file because it is being used by another process. Performing main compilation... D:\CUT1.3\POSClient\POS\ProcessController\Generic\ApplicationController.cs(17,46): error CS0234: The type or namespace name 'Partner' does not exist in the class or namespace 'HEC.POS.Presentation.ProcessController' (are you missing an assembly reference?)
Build complete -- 1 errors, 0 warnings Building satellite assemblies...
---------------------- Done ----------------------
Build: 22 succeeded, 6 failed, 0 skipped.
3) Lot of other Command line Switches like Release , Re-Build according to the Requirement and need.
Important Tips.
1) You can make all these commands as a Batch Process (Batch File) and you can deploy your Release Builds with out much fuss and in much lesser time. It will save a lot of time for Configuration Managers and Developers.
2) Build Process for .Net Developers they can easily build there project with out opening the solutions with Windows Script using Shell Commands. if there are any bugs while building it will create file called status.txt and states bugs in that. The Next Article I will be writing more about it.
3) Another Important point I want to make is that if we Consolidate all these command into a Single Batch file , then it will be very much helpful for us in making our Release Builds....
Advantages.
1) We hope to make many aspects of? Devenv /build? a little easier to use, but hopefully this information will make this feature less mystifying for the next time you want to use it.
2) If you look at the time it takes for loading the VS.Net projects and building. Using these Command line switches is comparably lot less then manual loading (Start->Programs->Visual Studio for .NET) of VS.Net project solutions and building. On the whole it will make the process of Building the Solutions much faster.
NOTE: THIS ARTICLE IS CONVERTED FROM C# TO VB.NET USING A CONVERSION TOOL. ORIGINAL ARTICLE CAN BE FOUND ON C# CORNER (WWW.C-SHARPCORNER.COM).
|
|
|
Login
to add your contents and source code to this article
|
|
|
|
|
|
|
|
tharakram
Tharak Ram is a Designer Analyst, Working in a Reputed CMM level 5 company. He has been working with .NET technology since pre beta releases.
|
|
|
|
|
|
|
|
|
C# Consulting is founded in 2002 by the founders of C# Corner. Unlike a traditional
consulting company, our consultants are well-known experts in .NET and many of them
are MVPs, authors, and trainers. We specialize in Microsoft .NET development and
utilize Agile Development and Extreme Programming practices to provide fast pace
quick turnaround results. Our software development model is a mix of Agile Development,
traditional SDLC, and Waterfall models.
|
|
Click here to learn more about C# Consulting. |
|
|
|
|
|
|
|
Introducing MaxV - one click. infinite control. Hyper-V Hosting from MaximumASP.
Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon.
Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees.
As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
|
Dynamic PDF
ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
|
Go.NET
Build custom interactive diagrams, network, workflow editors, flowcharts, or software design tools. Includes many predefined kinds of nodes, links, and basic shapes. Supports layers, scrolling, zooming, selection, drag-and-drop, clipboard, in-place editing, tooltips, grids, printing, overview window, palette. 100% implemented in C# as a managed .NET Control. Document/View/Tool architecture with many properties&events. Optional automatic layout.
|
Dundas Software
Dundas Chart for .NET is the most advanced .NET charting package available today. With an extremely complete feature set, elegant architecture and easy implementation, Dundas Chart can quickly add advanced Charting functionality to enhance and transform ASP.NET and Windows Forms applications. Whether you are implementing charting into internal projects, or building applications for clients, Dundas Chart offers advanced technology and advanced results to get the most out of data.
|
60 FREE UI Controls from DevExpress
Register for your FREE copy on over 60 free presentation controls from
DevExpress - Absolutely Free-of-Charge without any royalties or distribution
costs. Visit Devexpress.com/60 today. Free controls include advanced lists box, dropdown calendar, rich text edit, spin
edit, tab control and so much more!
DevExpress engineers feature rich presentation controls and reporting tools for WinForms, ASP.NET, WPF, and Silverlight. Our technologies help you build your best, see complex software with greater clarity and deliver compelling business solutions for Windows and the web in the shortest possible time.
|
Clickatell's SMS Gateway
Clickatell's Developer Solutions allow you to SMS enable any website or
application via a range of API's. Learn More about our API connections.
|
Microsoft Visual Studio 2010
Visualize your workspace with new multiple monitor support, powerful Web development, new SharePoint support with tons of templates and Web parts, and more accurate targeting of any version of the .NET Framework. Get set to unleash your creativity.
|
Nevron Chart for .NET 2010.1 Now Available
The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
|
Developer-Ready ASP.NET 2.0 Web Hosting with 3 MONTHS FREE
Now supporting .NET 3.0 Framework with Windows Workflow Foundation, Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), windows CardSpace (WCS)! Providing more flexibility for Developers with Web Services Support and a User/Permission Manger. Also supporting MS SQL 2005/2000 with Real-Time Backups, FREE Automated Attach .MDF Tool, FREE SQL Restore and Shrink SQL DB Tools, and SQL
|
|
|
|
|
|
|
|
|
|
|
|
|