Microsoft.VisualStudio.Project.ProjectNode.Build C# (CSharp) Method

Build() public method

Overloaded method. Invokes MSBuild using the default configuration and does without logging on the output window pane.
public Build ( string target ) : MSBuildResult
target string
return MSBuildResult
        public MSBuildResult Build(string target)
        {
            return this.Build(0, String.Empty, null, target);
        }

Same methods

ProjectNode::Build ( string target, IVsOutputWindowPane output ) : MSBuildResult
ProjectNode::Build ( string config, IVsOutputWindowPane output, string target ) : MSBuildResult
ProjectNode::Build ( string config, string target ) : MSBuildResult
ProjectNode::Build ( uint vsopts, string config, IVsOutputWindowPane output, string target ) : MSBuildResult

Usage Example

        // =========================================================================================
        // Constructors
        // =========================================================================================

        /// <summary>
        /// Initializes a new instance of the <see cref="XSharpBuildMacros"/> class.
        /// </summary>
        /// <param name="project">The project from which to read the properties.</param>
        public XBuildMacroCollection(ProjectNode project)
        {
            XHelperMethods.VerifyNonNullArgument(project, "project");

            // get the global SolutionX properties
            XBuildMacroCollection.DefineSolutionProperties(project);
            foreach (string globalMacroName in globalMacroNames)
            {
                string property = null;
                project.BuildProject.GlobalProperties.TryGetValue(globalMacroName, out property);
                if (null == property)
                {
                    this.list.Add(globalMacroName, "*Undefined*");
                }
                else
                {
                    this.list.Add(globalMacroName, property);
                }
            }
            // we need to call GetTargetPath first so that TargetDir and TargetPath are resolved correctly
            ConfigCanonicalName configCanonicalName;

            if (!Utilities.TryGetActiveConfigurationAndPlatform(project.Site, project, out configCanonicalName))
            {
                throw new InvalidOperationException();
            }
            BuildResult res = project.Build(configCanonicalName, XProjectFileConstants.GetTargetPath);

            // get the ProjectX and TargetX variables
            foreach (string macroName in macroNames)
            {
                string value;
                ThreadHelper.ThrowIfNotOnUIThread();
                if (res.ProjectInstance != null)
                {
                    value = res.ProjectInstance.GetPropertyValue(macroName);
                }
                else
                {
                    value = project.GetProjectProperty(macroName);
                }

                this.list.Add(macroName, value);
            }
        }
ProjectNode