当前位置: 首页>>代码示例>>C#>>正文


C# Project.GetEvaluatedProperty方法代码示例

本文整理汇总了C#中Microsoft.Build.BuildEngine.Project.GetEvaluatedProperty方法的典型用法代码示例。如果您正苦于以下问题:C# Project.GetEvaluatedProperty方法的具体用法?C# Project.GetEvaluatedProperty怎么用?C# Project.GetEvaluatedProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Microsoft.Build.BuildEngine.Project的用法示例。


在下文中一共展示了Project.GetEvaluatedProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoadSpecFlowProjectFromMsBuild

        public static SpecFlowProject LoadSpecFlowProjectFromMsBuild(string projectFile)
        {
            projectFile = Path.GetFullPath(projectFile);
            Project project = new Project();
            project.Load(projectFile, ProjectLoadSettings.IgnoreMissingImports);

            string projectFolder = Path.GetDirectoryName(projectFile);

            SpecFlowProject specFlowProject = new SpecFlowProject();
            specFlowProject.ProjectFolder = projectFolder;
            specFlowProject.ProjectName = Path.GetFileNameWithoutExtension(projectFile);
            specFlowProject.AssemblyName = project.GetEvaluatedProperty("AssemblyName");
            specFlowProject.DefaultNamespace = project.GetEvaluatedProperty("RootNamespace");

            var items = project.GetEvaluatedItemsByName("None").Cast<BuildItem>()
                .Concat(project.GetEvaluatedItemsByName("Content").Cast<BuildItem>());
            foreach (BuildItem item in items)
            {
                var extension = Path.GetExtension(item.FinalItemSpec);
                if (extension.Equals(".feature", StringComparison.InvariantCultureIgnoreCase))
                {
                    var featureFile = new SpecFlowFeatureFile(item.FinalItemSpec);
                    var ns = item.GetEvaluatedMetadata("CustomToolNamespace");
                    if (!String.IsNullOrEmpty(ns))
                        featureFile.CustomNamespace = ns;
                    specFlowProject.FeatureFiles.Add(featureFile);
                }

                if (Path.GetFileName(item.FinalItemSpec).Equals("app.config", StringComparison.InvariantCultureIgnoreCase))
                {
                    GeneratorConfigurationReader.UpdateConfigFromFile(specFlowProject.GeneratorConfiguration, Path.Combine(projectFolder, item.FinalItemSpec));
                }
            }
            return specFlowProject;
        }
开发者ID:xerxesb,项目名称:SpecFlow,代码行数:35,代码来源:MsBuildProjectReader.cs

示例2: Execute

		/// <summary>
		/// Executes this instance.
		/// </summary>
		public override bool Execute() {
			foreach (ITaskItem taskItem in this.Projects) {
				switch (GetClassification(taskItem)) {
					case ProjectClassification.VS2010Project:
						this.Log.LogMessage(MessageImportance.Low, "Downgrading project \"{0}\".", taskItem.ItemSpec);
						Project project = new Project();
						project.Load(taskItem.ItemSpec);
						project.DefaultToolsVersion = "3.5";

						if (this.DowngradeMvc2ToMvc1) {
							string projectTypeGuids = project.GetEvaluatedProperty("ProjectTypeGuids");
							if (!string.IsNullOrEmpty(projectTypeGuids)) {
								projectTypeGuids = projectTypeGuids.Replace("{F85E285D-A4E0-4152-9332-AB1D724D3325}", "{603c0e0b-db56-11dc-be95-000d561079b0}");
								project.SetProperty("ProjectTypeGuids", projectTypeGuids);
							}
						}

						// Web projects usually have an import that includes these substrings
						foreach (Import import in project.Imports) {
							import.ProjectPath = import.ProjectPath
								.Replace("$(MSBuildExtensionsPath32)", "$(MSBuildExtensionsPath)")
								.Replace("VisualStudio\\v10.0", "VisualStudio\\v9.0");
						}

						// VS2010 won't let you have a System.Core reference, but VS2008 requires it.
						BuildItemGroup references = project.GetEvaluatedItemsByName("Reference");
						if (!references.Cast<BuildItem>().Any(item => item.FinalItemSpec.StartsWith("System.Core", StringComparison.OrdinalIgnoreCase))) {
							project.AddNewItem("Reference", "System.Core");
						}

						project.Save(taskItem.ItemSpec);
						break;
					case ProjectClassification.VS2010Solution:
						this.Log.LogMessage(MessageImportance.Low, "Downgrading solution \"{0}\".", taskItem.ItemSpec);
						string[] contents = File.ReadAllLines(taskItem.ItemSpec);
						if (contents[1] != "Microsoft Visual Studio Solution File, Format Version 11.00" ||
							contents[2] != "# Visual Studio 2010") {
							this.Log.LogError("Unrecognized solution file header in \"{0}\".", taskItem.ItemSpec);
							break;
						}

						contents[1] = "Microsoft Visual Studio Solution File, Format Version 10.00";
						contents[2] = "# Visual Studio 2008";

						for (int i = 3; i < contents.Length; i++) {
							contents[i] = contents[i].Replace("TargetFrameworkMoniker = \".NETFramework,Version%3Dv", "TargetFramework = \"");
						}

						File.WriteAllLines(taskItem.ItemSpec, contents);
						break;
					default:
						this.Log.LogWarning("Unrecognized project type for \"{0}\".", taskItem.ItemSpec);
						break;
				}
			}

			return !this.Log.HasLoggedErrors;
		}
开发者ID:jongalloway,项目名称:dotnetopenid,代码行数:61,代码来源:DowngradeProjects.cs

示例3: TestConfigurationPlatformDefaults1

        public void TestConfigurationPlatformDefaults1()
        {
            string solutionFileContents =
                @"
                Microsoft Visual Studio Solution File, Format Version 9.00
                Global
                    GlobalSection(SolutionConfigurationPlatforms) = preSolution
                        Debug|Any CPU = Debug|Any CPU
                        Debug|Mixed Platforms = Debug|Mixed Platforms
                        Debug|Win32 = Debug|Win32
                        Release|Any CPU = Release|Any CPU
                        Release|Mixed Platforms = Release|Mixed Platforms
                        Release|Win32 = Release|Win32
                    EndGlobalSection
                EndGlobal
                ";

            SolutionParser solution = SolutionParser_Tests.ParseSolutionHelper(solutionFileContents);

            Project msbuildProject = new Project();
            SolutionWrapperProject.Generate(solution, msbuildProject, null, null);
            
            // Default for Configuration is "Debug", if present
            Assertion.AssertEquals("Debug", msbuildProject.GetEvaluatedProperty("Configuration"));

            // Default for Platform is "Mixed Platforms", if present
            Assertion.AssertEquals("Mixed Platforms", msbuildProject.GetEvaluatedProperty("Platform"));
        }
开发者ID:nikson,项目名称:msbuild,代码行数:28,代码来源:SolutionWrapperProject_Tests.cs

示例4: TestAddPropertyGroupForSolutionConfiguration

        public void TestAddPropertyGroupForSolutionConfiguration()
        {
            string solutionFileContents =
                @"
                Microsoft Visual Studio Solution File, Format Version 9.00
                # Visual Studio 2005
                Project('{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}') = 'ClassLibrary1', 'ClassLibrary1\ClassLibrary1.csproj', '{6185CC21-BE89-448A-B3C0-D1C27112E595}'
                EndProject
                Project('{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}') = 'MainApp', 'MainApp\MainApp.vcxproj', '{A6F99D27-47B9-4EA4-BFC9-25157CBDC281}'
                EndProject
                Global
                    GlobalSection(SolutionConfigurationPlatforms) = preSolution
                        Debug|Mixed Platforms = Debug|Mixed Platforms
                        Release|Any CPU = Release|Any CPU
                    EndGlobalSection
                    GlobalSection(ProjectConfigurationPlatforms) = postSolution
                        {6185CC21-BE89-448A-B3C0-D1C27112E595}.Debug|Mixed Platforms.ActiveCfg = CSConfig1|Any CPU
                        {6185CC21-BE89-448A-B3C0-D1C27112E595}.Debug|Mixed Platforms.Build.0 = CSConfig1|Any CPU
                        {6185CC21-BE89-448A-B3C0-D1C27112E595}.Release|Any CPU.ActiveCfg = CSConfig2|Any CPU
                        {A6F99D27-47B9-4EA4-BFC9-25157CBDC281}.Debug|Mixed Platforms.ActiveCfg = VCConfig1|Win32
                        {A6F99D27-47B9-4EA4-BFC9-25157CBDC281}.Debug|Mixed Platforms.Build.0 = VCConfig1|Win32
                    EndGlobalSection
                EndGlobal
                ";

            SolutionParser solution = SolutionParser_Tests.ParseSolutionHelper(solutionFileContents);

            Engine engine = new Engine();
            Project msbuildProject = new Project(engine);

            foreach (ConfigurationInSolution solutionConfiguration in solution.SolutionConfigurations)
            {
                SolutionWrapperProject.AddPropertyGroupForSolutionConfiguration(msbuildProject, solution, solutionConfiguration);
            }

            // Both projects configurations should be present for solution configuration "Debug|Mixed Platforms"
            msbuildProject.GlobalProperties.SetProperty("Configuration", "Debug");
            msbuildProject.GlobalProperties.SetProperty("Platform", "Mixed Platforms");

            string solutionConfigurationContents = msbuildProject.GetEvaluatedProperty("CurrentSolutionConfigurationContents");

            Assertion.Assert(solutionConfigurationContents.Contains("{6185CC21-BE89-448A-B3C0-D1C27112E595}"));
            Assertion.Assert(solutionConfigurationContents.Contains("CSConfig1|AnyCPU"));

            Assertion.Assert(solutionConfigurationContents.Contains("{A6F99D27-47B9-4EA4-BFC9-25157CBDC281}"));
            Assertion.Assert(solutionConfigurationContents.Contains("VCConfig1|Win32"));

            // Only the C# project should be present for solution configuration "Release|Any CPU", since the VC project
            // is missing
            msbuildProject.GlobalProperties.SetProperty("Configuration", "Release");
            msbuildProject.GlobalProperties.SetProperty("Platform", "Any CPU");

            solutionConfigurationContents = msbuildProject.GetEvaluatedProperty("CurrentSolutionConfigurationContents");

            Assertion.Assert(solutionConfigurationContents.Contains("{6185CC21-BE89-448A-B3C0-D1C27112E595}"));
            Assertion.Assert(solutionConfigurationContents.Contains("CSConfig2|AnyCPU"));

            Assertion.Assert(!solutionConfigurationContents.Contains("{A6F99D27-47B9-4EA4-BFC9-25157CBDC281}"));
        }
开发者ID:nikson,项目名称:msbuild,代码行数:59,代码来源:SolutionWrapperProject_Tests.cs

示例5: Execute

		/// <summary>
		/// Executes this instance.
		/// </summary>
		public override bool Execute() {
			var newProjectToOldProjectMapping = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
			var createdProjectFiles = new List<TaskItem>();

			foreach (ITaskItem taskItem in this.Projects) {
				switch (GetClassification(taskItem)) {
					case ProjectClassification.VS2010Project:
					case ProjectClassification.VS2010Solution:
						string projectNameForVS2008 = InPlaceDowngrade
														? taskItem.ItemSpec
														: Path.Combine(
															Path.GetDirectoryName(taskItem.ItemSpec),
															Path.GetFileNameWithoutExtension(taskItem.ItemSpec) + "-vs2008" +
															Path.GetExtension(taskItem.ItemSpec));
						newProjectToOldProjectMapping[taskItem.ItemSpec] = projectNameForVS2008;
						break;
				}
			}

			foreach (ITaskItem taskItem in this.Projects) {
				switch (GetClassification(taskItem)) {
					case ProjectClassification.VS2010Project:
						this.Log.LogMessage(MessageImportance.Low, "Downgrading project \"{0}\".", taskItem.ItemSpec);
						var project = new Project();
						project.Load(taskItem.ItemSpec, ProjectLoadSettings.IgnoreMissingImports);
						project.DefaultToolsVersion = "3.5";

						if (this.DowngradeMvc2ToMvc1) {
							string projectTypeGuids = project.GetEvaluatedProperty("ProjectTypeGuids");
							if (!string.IsNullOrEmpty(projectTypeGuids)) {
								projectTypeGuids = projectTypeGuids.Replace("{F85E285D-A4E0-4152-9332-AB1D724D3325}", "{603c0e0b-db56-11dc-be95-000d561079b0}");
								project.SetProperty("ProjectTypeGuids", projectTypeGuids);
							}
						}

						// MSBuild v3.5 doesn't support the GetDirectoryNameOfFileAbove function
						var enlistmentInfoImports = project.Imports.Cast<Import>().Where(i => i.ProjectPath.IndexOf("[MSBuild]::GetDirectoryNameOfFileAbove", StringComparison.OrdinalIgnoreCase) >= 0);
						enlistmentInfoImports.ToList().ForEach(i => project.Imports.RemoveImport(i));

						// Web projects usually have an import that includes these substrings));)
						foreach (Import import in project.Imports) {
							import.ProjectPath = import.ProjectPath
								.Replace("$(MSBuildExtensionsPath32)", "$(MSBuildExtensionsPath)")
								.Replace("VisualStudio\\v10.0", "VisualStudio\\v9.0");
						}

						// VS2010 won't let you have a System.Core reference, but VS2008 requires it.
						BuildItemGroup references = project.GetEvaluatedItemsByName("Reference");
						if (!references.Cast<BuildItem>().Any(item => item.FinalItemSpec.StartsWith("System.Core", StringComparison.OrdinalIgnoreCase))) {
							project.AddNewItem("Reference", "System.Core");
						}

						// Rewrite ProjectReferences to other renamed projects.
						BuildItemGroup projectReferences = project.GetEvaluatedItemsByName("ProjectReference");
						foreach (var mapping in newProjectToOldProjectMapping) {
							string oldName = Path.GetFileName(mapping.Key);
							string newName = Path.GetFileName(mapping.Value);
							foreach (BuildItem projectReference in projectReferences) {
								projectReference.Include = Regex.Replace(projectReference.Include, oldName, newName, RegexOptions.IgnoreCase);
							}
						}

						project.Save(newProjectToOldProjectMapping[taskItem.ItemSpec]);
						createdProjectFiles.Add(new TaskItem(taskItem) { ItemSpec = newProjectToOldProjectMapping[taskItem.ItemSpec] });
						break;
					case ProjectClassification.VS2010Solution:
						this.Log.LogMessage(MessageImportance.Low, "Downgrading solution \"{0}\".", taskItem.ItemSpec);
						string[] contents = File.ReadAllLines(taskItem.ItemSpec);
						if (contents[1] != "Microsoft Visual Studio Solution File, Format Version 11.00" ||
							contents[2] != "# Visual Studio 2010") {
							this.Log.LogError("Unrecognized solution file header in \"{0}\".", taskItem.ItemSpec);
							break;
						}

						contents[1] = "Microsoft Visual Studio Solution File, Format Version 10.00";
						contents[2] = "# Visual Studio 2008";

						for (int i = 3; i < contents.Length; i++) {
							contents[i] = contents[i].Replace("TargetFrameworkMoniker = \".NETFramework,Version%3Dv", "TargetFramework = \"");
						}

						foreach (var mapping in newProjectToOldProjectMapping) {
							string oldName = Path.GetFileName(mapping.Key);
							string newName = Path.GetFileName(mapping.Value);
							for (int i = 0; i < contents.Length; i++) {
								contents[i] = Regex.Replace(contents[i], oldName, newName, RegexOptions.IgnoreCase);
							}
						}

						File.WriteAllLines(newProjectToOldProjectMapping[taskItem.ItemSpec], contents);
						createdProjectFiles.Add(new TaskItem(taskItem) { ItemSpec = newProjectToOldProjectMapping[taskItem.ItemSpec] });
						break;
					default:
						this.Log.LogWarning("Unrecognized project type for \"{0}\".", taskItem.ItemSpec);
						break;
				}
			}
//.........这里部分代码省略.........
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:101,代码来源:DowngradeProjects.cs

示例6: getVBCSTargetName

        private static String getVBCSTargetName(String vbcsProj, String configuration)
        {
            String targetName = null;
            String outputPath = null;
            config = properties.getConfig();

            // Create a new empty project
            Project project = new Project();

            // Load a project
            try
            {
                project.Load(vbcsProj);
            }
            catch (Exception e)
            {
                mh.error("Problems loading project file! " + e.Message);
                return "";
            }

            vbcsProj = project.FullFileName;
            Dictionary<String, BuildPropertyGroup> config2PropGroup = new Dictionary<String, BuildPropertyGroup>();

            targetName = project.GetEvaluatedProperty("TargetFileName");
            if (targetName.Equals("") || targetName == null)
            {
                mh.error("Could not resolve TargetFileName value in Project \"" + vbcsProj + "\"");
                return "";
            }
            // Iterate through the various property groups and subsequently
            // through the various properties
            foreach (BuildPropertyGroup propertyGroup in project.PropertyGroups)
            {
                String cond = propertyGroup.Condition;
                if (!cond.Equals("") && (cond.IndexOf("Configuration", StringComparison.InvariantCultureIgnoreCase) >= 0) && (cond.IndexOf("==", StringComparison.InvariantCultureIgnoreCase) >= 0))
                {
                    int platformIndex = cond.LastIndexOf("|");
                    int cfgIndex = cond.LastIndexOf("==") + 4;
                    int substrLength = platformIndex - cfgIndex;
                    String confSubstr = cond.Substring(cfgIndex, substrLength);
                    if (config2PropGroup.ContainsKey(confSubstr))
                        continue;
                    config2PropGroup.Add(confSubstr, propertyGroup);
                }
            }

            String cfgKey = null;
            String firstCfgKey = null;
            BuildPropertyGroup bpgMatch = null;
            BuildPropertyGroup firstBpgMatch = null;
            bool foundExactMatch = false;
            bool foundCloseMatch = false;
            int i = 0;
            foreach (KeyValuePair<string, BuildPropertyGroup> kvp in config2PropGroup)
            {
                String tmpCfg = kvp.Key;
                config = properties.getConfig();
                if (i == 0)
                {
                    firstCfgKey = tmpCfg;
                    firstBpgMatch = kvp.Value;
                    i++;
                }
                if (tmpCfg.Equals(config, StringComparison.InvariantCultureIgnoreCase))
                {
                    bpgMatch = kvp.Value;
                    cfgKey = tmpCfg;
                    foundExactMatch = true;
                    break;
                }
                else if (tmpCfg.IndexOf(config, StringComparison.InvariantCultureIgnoreCase) >= 0)
                {
                    bpgMatch = kvp.Value;
                    cfgKey = tmpCfg;
                    foundCloseMatch = true;
                }
            }
            if (!foundExactMatch && foundCloseMatch) //may enhance later to try to derive alternative config matches
            {
                mh.warn("Could not find configuration match for \"" + config + "\" in \"" + vbcsProj + "\"");
                Console.WriteLine("Please create TGT either manually in the Meister GUI or by changing the default configuration passed to the TGT generator.");
                return "";
                //mh.warn("Could not find exact configuration match for: \"" + config + "\". Using configuration \"" + cfgKey + "\"");
            }
            else if (!foundExactMatch && !foundCloseMatch) //may enhance later to try to derive alternative config matches
            {
                mh.warn("Could not find configuration match for \"" + config + "\" in \"" + vbcsProj + "\"");
                Console.WriteLine("Please create TGT either manually in the Meister GUI or by changing the default configuration to the generator");
                return "";
                //cfgKey = firstCfgKey;
                //bpgMatch = firstBpgMatch;
                //mh.warn("Could not find a close configuration match for: \"" + config + "\". Using first configuration found \"" + cfgKey + "\"");
            }

            foreach (BuildProperty prop in bpgMatch)
            {
                if (prop.Name.Equals("OutputPath", StringComparison.InvariantCultureIgnoreCase))
                {
                    //Console.WriteLine("{0}:{1}", prop.Name, prop.Value);
                    outputPath = prop.Value;
//.........这里部分代码省略.........
开发者ID:sblanton,项目名称:om-services,代码行数:101,代码来源:Program.cs

示例7: SetPropertyCondition_Empty

 public void SetPropertyCondition_Empty()
 {
     Project p = new Project();
     p.SetProperty("n", "v", String.Empty);
     Assertion.AssertEquals("v", p.GetEvaluatedProperty("n"));
 }
开发者ID:nikson,项目名称:msbuild,代码行数:6,代码来源:Project_Tests.cs

示例8: ScanProjectDependencies

        /// <summary>
        /// Loads each MSBuild project in this solution and looks for its project-to-project references so that
        /// we know what build order we should use when building the solution. 
        /// </summary>
        /// <owner>LukaszG</owner>
        static private void ScanProjectDependencies(SolutionParser solution, Engine parentEngine, string childProjectToolsVersion, string fullSolutionConfigurationName, BuildEventContext projectBuildEventContext)
        {
            string message = null;

            // Don't bother with all this if the solution configuration doesn't even exist.
            if (fullSolutionConfigurationName == null)
            {
                return;
            }

            foreach (ProjectInSolution project in solution.ProjectsInOrder)
            {
                // Skip the project if we don't have its configuration in this solution configuration
                if (!project.ProjectConfigurations.ContainsKey(fullSolutionConfigurationName))
                {
                    continue;
                }

                if ((project.ProjectType == SolutionProjectType.ManagedProject) || 
                    ((project.ProjectType == SolutionProjectType.Unknown) && (project.CanBeMSBuildProjectFile(out message))))
                {
                    try
                    {
                        //Will fail to load a throw an error if the tools version is incorrect.
                        Project msbuildProject = new Project(parentEngine, childProjectToolsVersion);
                        msbuildProject.IsLoadedByHost = false;
                        
                        // this is before building the solution wrapper project, so the current directory may be not set to
                        // the one containing the solution file, and we'd get the relative path wrong
                        msbuildProject.Load(project.AbsolutePath);

                        // Project references for MSBuild projects could be affected by the active configuration, 
                        // so set it before retrieving references.
                        msbuildProject.GlobalProperties.SetProperty("Configuration",
                            project.ProjectConfigurations[fullSolutionConfigurationName].ConfigurationName, true /* treat as literal */);
                        msbuildProject.GlobalProperties.SetProperty("Platform", 
                            project.ProjectConfigurations[fullSolutionConfigurationName].PlatformName, true /* treat as literal */);
                        
                        BuildItemGroup references = msbuildProject.GetEvaluatedItemsByName("ProjectReference");
                        
                        foreach (BuildItem reference in references)
                        {
                            string referencedProjectGuid = reference.GetEvaluatedMetadata("Project");   // Need unescaped data here.
                            AddDependencyByGuid(solution, project, parentEngine, projectBuildEventContext, referencedProjectGuid);
                        }

                        //
                        // ProjectDependency items work exactly like ProjectReference items from the point of 
                        // view of determining that project B depends on project A.  This item must cause
                        // project A to be built prior to project B.
                        //
                        references = msbuildProject.GetEvaluatedItemsByName("ProjectDependency");

                        foreach (BuildItem reference in references)
                        {
                            string referencedProjectGuid = reference.GetEvaluatedMetadata("Project");   // Need unescaped data here.
                            AddDependencyByGuid(solution, project, parentEngine, projectBuildEventContext, referencedProjectGuid);
                        }

                        //
                        // If this is a web deployment project, we have a reference specified as a property
                        // "SourceWebProject" rather than as a ProjectReference item.  This has the format
                        // {GUID}|PATH_TO_CSPROJ
                        // where
                        // GUID is the project guid for the "source" project
                        // PATH_TO_CSPROJ is the solution-relative path to the csproj file.
                        //
                        // NOTE: This is obsolete and is intended only for backward compatability with
                        // Whidbey-generated web deployment projects.  New projects should use the
                        // ProjectDependency item above.
                        //
                        string referencedWebProjectGuid = msbuildProject.GetEvaluatedProperty("SourceWebProject");
                        if (!string.IsNullOrEmpty(referencedWebProjectGuid))
                        {
                            // Grab the guid with its curly braces...
                            referencedWebProjectGuid = referencedWebProjectGuid.Substring(0, 38);
                            AddDependencyByGuid(solution, project, parentEngine, projectBuildEventContext, referencedWebProjectGuid);
                        }                                                
                    }
                    // We don't want any problems scanning the project file to result in aborting the build.
                    catch (Exception e)
                    {
                        if (ExceptionHandling.IsCriticalException(e)) throw;

                        parentEngine.LoggingServices.LogWarning(projectBuildEventContext, "SubCategoryForSolutionParsingErrors", new BuildEventFileInfo(project.RelativePath),
                            "SolutionScanProjectDependenciesFailed", project.RelativePath, e.Message);
                    }
                }
                else if (project.ProjectType == SolutionProjectType.VCProject)
                {
                    try
                    {
                        XmlDocument doc = new XmlDocument();
                        doc.Load(project.AbsolutePath);

//.........这里部分代码省略.........
开发者ID:nikson,项目名称:msbuild,代码行数:101,代码来源:SolutionWrapperProject.cs

示例9: SetImportedPropertyCondition_Null

 public void SetImportedPropertyCondition_Null()
 {
     string importedProjFilename = String.Empty;
     string mainProjFilename = String.Empty;
     try
     {
         importedProjFilename = ObjectModelHelpers.CreateTempFileOnDisk(TestData.PropertyGroup);
         mainProjFilename = ObjectModelHelpers.CreateTempFileOnDisk(TestData.Content3SimpleTargetsDefaultSpecified);
         Project mainProject = new Project(new Engine());
         Project importedProject = new Project(mainProject.ParentEngine);
         mainProject.Load(mainProjFilename);
         importedProject.Load(importedProjFilename);
         mainProject.SetImportedProperty("n1", "newV", null, importedProject);
         Assertion.AssertEquals("newV", importedProject.GetEvaluatedProperty("n1"));
     }
     finally
     {
         CompatibilityTestHelpers.RemoveFile(importedProjFilename);
         CompatibilityTestHelpers.RemoveFile(mainProjFilename);
     }
 }
开发者ID:nikson,项目名称:msbuild,代码行数:21,代码来源:Project_Tests.cs

示例10: SetPropertySetValueLiteralFlag

            public void SetPropertySetValueLiteralFlag()
            { 
                string importedProjFilename = String.Empty;
                string mainProjFilename = String.Empty;
                try
                {
                    importedProjFilename = ObjectModelHelpers.CreateTempFileOnDisk(TestData.PropertyGroup);
                    mainProjFilename = ObjectModelHelpers.CreateTempFileOnDisk(TestData.Content3SimpleTargetsDefaultSpecified);
                    Project mainProject = new Project(new Engine());
                    Project importedProject = new Project(mainProject.ParentEngine);
                    mainProject.Load(mainProjFilename);
                    importedProject.Load(importedProjFilename);
                    mainProject.SetImportedProperty("n1", "newV", "true", importedProject, PropertyPosition.UseExistingOrCreateAfterLastImport, true);
                    mainProject.SetImportedProperty("literalFalse", @"%25%2a%3f%40%24%28%29%3b\", "true", importedProject, PropertyPosition.UseExistingOrCreateAfterLastImport, false);
                    mainProject.SetImportedProperty("literalTrue", @"%25%2a%3f%40%24%28%29%3b\", "true", importedProject, PropertyPosition.UseExistingOrCreateAfterLastImport, true);
                    mainProject.SetImportedProperty("nonLiteralFalse", @"%*[email protected]$();\", "true", importedProject, PropertyPosition.UseExistingOrCreateAfterLastImport, false);
                    mainProject.SetImportedProperty("nonLiteralTrue", @"%*[email protected]$();\", "true", importedProject, PropertyPosition.UseExistingOrCreateAfterLastImport, true);

                    Assertion.AssertEquals(@"%*[email protected]$();\", mainProject.GetEvaluatedProperty("literalFalse"));
                    Assertion.AssertEquals(@"%*[email protected]$();\", mainProject.GetEvaluatedProperty("nonLiteralTrue"));
                    Assertion.AssertEquals(@"%25%2a%3f%40%24%28%29%3b\", mainProject.GetEvaluatedProperty("literalTrue"));
                    Assertion.AssertEquals(@"%*[email protected];\", mainProject.GetEvaluatedProperty("nonLiteralFalse"));
                }
                finally
                {
                    CompatibilityTestHelpers.RemoveFile(importedProjFilename);
                    CompatibilityTestHelpers.RemoveFile(mainProjFilename);
                }
            }
开发者ID:nikson,项目名称:msbuild,代码行数:29,代码来源:Project_Tests.cs

示例11: SetPropertySetValue_literals

 public void SetPropertySetValue_literals()
 {
     Project p = new Project();
     p.SetProperty("literalFalse", @"%25%2a%3f%40%24%28%29%3b\", "true", PropertyPosition.UseExistingOrCreateAfterLastImport, false);
     p.SetProperty("literalTrue", @"%25%2a%3f%40%24%28%29%3b\", "true", PropertyPosition.UseExistingOrCreateAfterLastImport, true);
     p.SetProperty("nonLiteralFalse", @"%*[email protected]$();\", "true", PropertyPosition.UseExistingOrCreateAfterLastImport, false);
     p.SetProperty("nonLiteralTrue", @"%*[email protected]$();\", "true", PropertyPosition.UseExistingOrCreateAfterLastImport, true);
     Assertion.AssertEquals(@"%*[email protected]$();\", p.GetEvaluatedProperty("literalFalse"));
     Assertion.AssertEquals(@"%*[email protected]$();\", p.GetEvaluatedProperty("nonLiteralTrue"));
     Assertion.AssertEquals(@"%25%2a%3f%40%24%28%29%3b\", p.GetEvaluatedProperty("literalTrue"));
     Assertion.AssertEquals(@"%*[email protected];\", p.GetEvaluatedProperty("nonLiteralFalse"));
 }
开发者ID:nikson,项目名称:msbuild,代码行数:12,代码来源:Project_Tests.cs

示例12: SetPropertySetExisting

 public void SetPropertySetExisting()
 {
     Project p = new Project();
     p.SetProperty("property_name", "v");
     p.SetProperty("property_name", "v2");
     Assertion.AssertEquals("v2", p.GetEvaluatedProperty("property_name"));
     Assertion.AssertEquals(true, p.Xml.Contains("property_name"));
     Assertion.AssertEquals(true, p.IsDirty);
 }
开发者ID:nikson,项目名称:msbuild,代码行数:9,代码来源:Project_Tests.cs

示例13: SetPropertyCondition_False

 public void SetPropertyCondition_False()
 {
     Project p = new Project();
     p.SetProperty("n", "v", "false");
     Assertion.AssertNull(p.GetEvaluatedProperty("n"));
 }
开发者ID:nikson,项目名称:msbuild,代码行数:6,代码来源:Project_Tests.cs

示例14: SetPropertyCondition_True

 public void SetPropertyCondition_True()
 {
     Project p = new Project();
     p.SetProperty("n", "v", "1 == 1");
     Assertion.AssertEquals("v", p.GetEvaluatedProperty("n"));
 }
开发者ID:nikson,项目名称:msbuild,代码行数:6,代码来源:Project_Tests.cs

示例15: TestConfigurationPlatformDefaults2

        public void TestConfigurationPlatformDefaults2()
        {
            string solutionFileContents =
                @"
                Microsoft Visual Studio Solution File, Format Version 9.00
                Global
                    GlobalSection(SolutionConfigurationPlatforms) = preSolution
                        Release|Any CPU = Release|Any CPU
                        Release|Win32 = Release|Win32
                        Other|Any CPU = Other|Any CPU
                        Other|Win32 = Other|Win32
                    EndGlobalSection
                EndGlobal
                ";

            SolutionParser solution = SolutionParser_Tests.ParseSolutionHelper(solutionFileContents);

            Project msbuildProject = new Project();

            SolutionWrapperProject.Generate(solution, msbuildProject, null, null);

            // If "Debug" is not present, just pick the first configuration name
            Assertion.AssertEquals("Release", msbuildProject.GetEvaluatedProperty("Configuration"));

            // if "Mixed Platforms" is not present, just pick the first platform name
            Assertion.AssertEquals("Any CPU", msbuildProject.GetEvaluatedProperty("Platform"));
        }
开发者ID:nikson,项目名称:msbuild,代码行数:27,代码来源:SolutionWrapperProject_Tests.cs


注:本文中的Microsoft.Build.BuildEngine.Project.GetEvaluatedProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。