public override void Generate(ProjectType projectType, Microsoft.Build.Evaluation.Project project) {
     project.SetProperty(Name, Value + projectType.CodeExtension);
 }
Example #2
0
        private IEnumerable<string> ResolveAssemblyReferences(Microsoft.Build.Evaluation.Project project)
        {
            var projectInstance = project.CreateProjectInstance();
            projectInstance.SetProperty("BuildingProject", "false");
            project.SetProperty("DesignTimeBuild", "true");

            projectInstance.Build("ResolveAssemblyReferences", new[] { new ConsoleLogger(LoggerVerbosity.Minimal) });
            var items = projectInstance.GetItems("_ResolveAssemblyReferenceResolvedFiles");
            return items.Select(i => Path.Combine(Path.GetDirectoryName(this.FileName), i.GetMetadataValue("Identity")));
        }
        private static void SetTreatLevel(Microsoft.Build.BuildEngine.Project project, BuildIntegration buildIntegration)
        {
            Param.AssertNotNull(project, "project");
            Param.AssertNotNull(buildIntegration, "enable");

            switch (buildIntegration)
            {
                case BuildIntegration.None:
                    break;
                case BuildIntegration.TreatErrorAsWarning:
                    project.SetProperty(StyleCopTreatErrorsAsWarnings, true.ToString(), string.Empty);
                    break;
                case BuildIntegration.TreatErrorAsError:
                    project.SetProperty(StyleCopTreatErrorsAsWarnings, false.ToString(), string.Empty);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("buildIntegration");
            }
        }
        public void SetWarehouseVersion(Microsoft.TeamFoundation.Warehouse.WarehouseDataAccessComponent dac)
        {
            var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version;

            dac.SetProperty(null, VersionPropertyBagKey, assemblyVersion.ToString());
        }
Example #5
0
		IEnumerable<string> ResolveAssemblyReferences(Microsoft.Build.Evaluation.Project project)
		{
			// Use MSBuild to figure out the full path of the referenced assemblies
			var projectInstance = project.CreateProjectInstance();
			projectInstance.SetProperty("BuildingProject", "false");
			project.SetProperty("DesignTimeBuild", "true");
			
			projectInstance.Build("ResolveAssemblyReferences", new [] { new ConsoleLogger(LoggerVerbosity.Minimal) });
			var items = projectInstance.GetItems("_ResolveAssemblyReferenceResolvedFiles");
			string baseDirectory = Path.GetDirectoryName(this.FileName);
			var result = items.Select(i => Path.Combine(baseDirectory, i.GetMetadataValue("Identity"))).ToList();
			if (!result.Any(t => t.Contains("mscorlib") || t.Contains("System.Runtime")))
				result.Add(typeof(object).Assembly.Location);
			return result;
		}