Visual Studio .NET Action

   

 

This action provides the ability to build Visual Studio .NET solutions using FinalBuilder. You can choose to build, rebuild or clean the whole solution or selected projects in the solution. You can also choose which Solution Configuration to use.

 

BuildVSDotNet

 

Solution File

 

The path to the solution file to build. If the solution file is found at design-time, the configuration and project lists will be automatically populated.

 

Click the refresh button (as shown) to reload the solution and refresh the configuration, version and project names.

buildvsdotnet-closeup1

 

 

Configuration

 

Choose the solution configuration to build. Available configurations are automatically loaded from the solution file and shown in the dropdown list.

 

If the solution file cannot be found, the dropdown shows the default Visual Studio.NET configurations.

 

 

VS.NET Version

 

Specify the version of Visual Studio to build the solution. A solution file can only be built by the version of Visual Studio that created it.

 

The correct version is automatically chosen in the solution file is loaded at design-time.

 

 

Use MSBuild

 

Solution files created by Visual Studio 2005 and newer can be built by MSBuild. Check the "Use MSBuild" checkbox to build with MSBuild instead of Visual Studio. If you enable this option, you do not need Visual Studio installed on the build machine. Choosing this option also enables a lot of the custom properties of the action, and allows you to set custom MSBuild Properties as well.

 

Note that not all project types can be built with MSBuild. There are also differences involving Unloaded Projects (see below for details.)

 

 

Action

 

Choose the action (Build, Rebuild, Clean or Deploy) to perform. These are all the equivalent of taking the same action in the Visual Studio IDE.

 

 

Apply To Project

 

You can choose to build all projects in a solution, or only build certain projects.

 

All Enabled Projects

Selecting this option will build the chosen configuration, as defined in the Configuration Manager in Visual Studio. Only projects with the "Build" flag set in Configuration Manager will be built.

 

All Projects in Solution

Selecting this option means that every single project in the solution will be built, regardless of whether or not it is set to "Build" as part of the selected configuration.

 

All Projects in Solution

Selecting this option allows you to choose which projects to build, using the listbox shown to the right of the option. Only checked projects will be built.

See below for some discussion on how to choose which projects to build dynamically at runtime (using script.)

 

The only time this behaviour changes is when there are Unloaded Projects (see below for details.)

 

 

BuildVSDotNet_Paths

 

(The options on this page are only available when the "Use MSBuild" option is enabled.)

 

 

Build Output

 

Enter an output directory here to override the default output directory for each project in the solution. If this field is left blank, the default output directory will be used.

 

 

Reference Paths

 

If the "Override project Reference Paths" option is enabled, this list of paths will be used to resolve search for assembly references. This list overrides the list of paths set on the "Reference Paths" tab for a Visual Studio project (this list is normally stored in each project's .user file.)

 

 

BuildVSDotNet_Build

 

(Apart from "Use Environment Variables...", all of the options on this page are only available when "Use MSBuild" is enabled.)

 

 

Use Environment Variables for C++ Paths

 

When building Visual C++ projects, enabling this option will use the environment variable values PATH, INCLUDE, LIBS, and LIBPATH when starting Visual Studio. This is equivalent to passing the /useenv option to Visual Studio, or the /p:useenv=1 argument to MSBuild.

 

 

Log Detail Level

 

Specify the level of output detail you would like to see in the log. Minimal will only show basic compilation steps. Normal shows all major targets. Detailed and Diagnostic can be used to analyse complex build scenarios.

 

Max CPUs

 

This option is only enabled when Visual Studio 2008 is being used for the build. You can limit the maximum number of CPUs to use for building, or set it to "All Available" to use all available CPUs.

 

 

Override compiler settings

 

If this checkbox is selected, then all of the following configuration properties will be overriden:

 

Compile Constants: Specify conditional constants to define. Separate multiple constants with semicolons.

DEBUG / TRACE: Check these boxes to specifically enable these two constants.

Optimize Code: Check this box to enable code optimization.

Allow unsafe code: Check this box to allow unsafe code.

 

 

Override Warning settings

 

If this checkbox is selected, then all of the following Warning-related properties will be overriden:

 

Warning Level: Specify the level of warning output to display.

Treat All Warnings as Errors: If this option is enabled, any compiler warning will cause the build to fail.

Treat Specified Warnings as Errors: Specify one or more warning numbers to treat as errors. Separate multiple warning numbers with semicolons.

Disable These Warnings: Specify one or more warning numbers to completely ignore. Separate multiple warning numbers with semicolons.

 

 

Override Target Framework

 

This option is only enabled when using Visual Studio 2008. It allows you to build projects against an earlier version of the .NET Framework.

 

 

vsdotnetVersionInfo

 

 

The .NET Version page allows the action to update AssemblyInfo files in all or selected .NET projects in the solution. Note that this will not work for any ASP.NET Web Sites in the solution.

 

Specify the details that you would like to set. The "Use PropertySet for Version Info" dropdown allows you to use a PropertySet to populate the version information (see dedicated topic.)

 

 

 

BuildVSDotNet_Win32Version

 

The Win32 Version page allows the action to update .RC files in all or selected C++ projects in the solution.

 

Specify the details that you would like to set. The "Use PropertySet for Version Info" dropdown allows you to use a PropertySet to populate the version information (see dedicated topic.)

 

 

 

 

 

Scripting

 

In addition to the common scripting properties, this action supports 3 additional script functions

 

Action.GetProjectID

This function takes the path to a project file, or the name of a project, and returns the internal ID (GUID) for that project. If the project is not found in the current solution, the function returns an empty string. Paths can be absolute, or relative to the solution file.

 

Action.GetProjectName

This function takes the ID of a project inside the solution, and returns the name (as shown in the Visual Studio IDE.) If the project ID is not found in the current solution, the function returns an empty string.

 

Action.GetProjectPath

This function takes the ID of a project inside the solution, and returns the project file path (relative to the solution directory.) If the project ID is not found in the current solution, the function returns an empty string.

 

 

 

Dynamically Choosing Which Projects to Build at Runtime

 

It is possible to dynamically configure the list of projects to build at runtime, using the Action.SelectedProjects property. This property is a TStrings property which contains the list of project IDs to build, if "Build Selected Projects" is enabled.

 

Another way to do this is to use Visual Studio .NET Solution Iterator.

 

Although the list normally contains Project IDs, it is possible to add project names and paths to the list, ie Action.SelectedProjects.Add("My Project Name").

 

Therefore, to set the list of projects to build from a CRLF-delimited string variable "MyProjects", which contains a list of project names or paths, it is possible to use script like this in the BeforeAction event of the action:

 

Action.SelectedProjects = FBVariables.MyProjects;

 

Note that the names are automatically converted to project IDs when the value is set. If the name does not represent a valid project, the entry is not added

 

 

Solutions Which Contain Unloaded Projects

 

It is possible to unload a project in Visual Studio by right-clicking in Solution Explorer and selecting "Unload Project". Unloaded projects build differently, depending on if you have chosen "Use MSBuild" or not.

 

With "Use MSBuild" enabled, unloaded projects behave exactly the same as loaded projects. If you choose to build "All Projects", then all projects (including unloaded projects) will build. If you choose to build "Selected Projects", then all the selected projects will build.

 

Without "Use MSBuild" enabled, unloaded projects will never be built, even if they are explicitly selected.

 

 

Extra MSBuild Properties

 

It is possible to pass custom MSBuild Properties to the build process when "Use MSBuild" is selected. This allows you to set build properties which are not supported natively by the action.

 

To set these properties, select the action and click on the Properties tab. Under the MSBuild section is a property called "Extra MSBuild Properties":

 

BuildVSDotNet_extraArgs

Click the ellipsis button to edit the list of extra properties. Place each property on a new line. Properties take the form <Name>=<Value>.