示例#1
0
        public MSBuildConfiguration(MSBuildProject project, Microsoft.Build.BuildEngine.Project msproj, Configuration projectConfig)
            : base(project)
        {
            _name = projectConfig.Name;

            msproj.GlobalProperties.SetProperty("Configuration", _name);
            project.SetPlatform (projectConfig.Platform);
            _platform = msproj.GetEvaluatedProperty("Platform");

            _relativeOutputDir = msproj.GetEvaluatedProperty("OutputPath");
            if (!_relativeOutputDir.EndsWith(Path.DirectorySeparatorChar.ToString(CultureInfo.InvariantCulture))) {
                _relativeOutputDir = _relativeOutputDir + Path.DirectorySeparatorChar;
            }
            _outputDir = new DirectoryInfo(FileUtils.CombinePaths(
                project.ProjectDirectory.FullName,
                _relativeOutputDir));

            _objdir = new DirectoryInfo(msproj.GetEvaluatedProperty("IntermediateOutputPath"));

            _outputType = GetType(msproj.GetEvaluatedProperty("OutputType"));
            _asmname = msproj.GetEvaluatedProperty("AssemblyName");
        }
        internal static BuildIntegration GetBuildIntegrationInProject(Microsoft.Build.BuildEngine.Project project)
        {
            Param.AssertNotNull(project, "project");

            ProjectUtilities.BuildIntegration setting = BuildIntegration.None;
            if (project.Imports.Cast<Import>().Any(p => p.ProjectPath.IndexOf(StyleCopTargetsName, StringComparison.OrdinalIgnoreCase) != -1))
            {
                setting = BuildIntegration.TreatErrorAsWarning;
                string property = project.GetEvaluatedProperty(StyleCopTreatErrorsAsWarnings);
                bool treatAsWarnings;
                if (bool.TryParse(property, out treatAsWarnings) && !treatAsWarnings)
                {
                    setting = BuildIntegration.TreatErrorAsError;
                }
            }

            return setting;
        }