Exemplo n.º 1
0
        protected virtual void Refresh()
        {
            // Let MSBuild know which configuration we are working with
            project.SetConfiguration(projectCfg.ConfigCanonicalName);


            if (project.ProjectInstance.Targets.ContainsKey(ProjectFileConstants.AllProjectOutputGroups))
            {
                bool succeeded = false;
                project.BuildTarget(ProjectFileConstants.AllProjectOutputGroups, out succeeded);
                Debug.Assert(succeeded, "Failed to build target: " + ProjectFileConstants.AllProjectOutputGroups);
            }

            // Rebuild the content of our list of output
            string outputType = this.targetName + "KeyOutput";

            this.outputs.Clear();
            foreach (MSBuildExecution.ProjectItemInstance assembly in MSBuildProjectInstance.GetItems(project.ProjectInstance, outputType))
            {
                Output output = new Output(project, assembly);
                this.outputs.Add(output);

                // See if it is our key output
                if (String.Compare(MSBuildItem.GetMetadataValue(assembly, "IsKeyOutput"), true.ToString(), StringComparison.OrdinalIgnoreCase) == 0)
                {
                    keyOutput = output;
                }
            }

            project.SetCurrentConfiguration();

            // Now that the group is built we have to check if it is invalidated by a property
            // change on the project.
            project.OnProjectPropertyChanged += new EventHandler <ProjectPropertyChangedArgs>(OnProjectPropertyChanged);
        }
Exemplo n.º 2
0
        public MSBuild.BuildProperty GetMsBuildProperty(string propertyName, bool resetCache, MSBuild.Project buildProject)
        {
            if (resetCache || this.currentConfig == null)
            {
                // Get properties for current configuration from project file and cache it
                this.project.SetConfiguration(this.ConfigName, this.PlatformName);
                this.currentConfig = buildProject.EvaluatedProperties;

                project.SetCurrentConfiguration();
            }

            if (this.currentConfig == null)
            {
                throw new Exception("Failed to retrive properties");
            }

            // return property asked for
            return(this.currentConfig[propertyName]);
        }
Exemplo n.º 3
0
        protected virtual void Refresh()
        {
            // Let MSBuild know which configuration we are working with
            project.SetConfiguration(projectCfg.ConfigName);

            // Generate dependencies if such a task exist
            const string generateDependencyList = "AllProjectOutputGroups";

            if (project.BuildProject.Targets.Exists(generateDependencyList))
            {
                bool succeeded = false;
                project.BuildTarget(generateDependencyList, out succeeded);
                Debug.Assert(succeeded, "Failed to build target: " + generateDependencyList);
            }

            // Rebuild the content of our list of output
            string outputType = this.targetName + "KeyOutput";

            this.outputs.Clear();
            foreach (MSBuild.BuildItem assembly in project.BuildProject.GetEvaluatedItemsByName(outputType))
            {
                Output output = new Output(project, projectCfg, project.GetProjectElement(assembly));
                this.outputs.Add(output);

                // See if it is our key output
                if (String.Compare(assembly.GetEvaluatedMetadata("IsKeyOutput"), true.ToString(), StringComparison.OrdinalIgnoreCase) == 0)
                {
                    keyOutput = output;
                }
            }

            project.SetCurrentConfiguration();

            // Now that the group is built we have to check if it is invalidated by a property
            // change on the project.
            project.OnProjectPropertyChanged += new EventHandler <ProjectPropertyChangedArgs>(OnProjectPropertyChanged);
        }