Exemplo n.º 1
0
 /// <summary>
 /// Instantiate a new IdentifierGenerator.
 /// </summary>
 /// <param name="baseName">The base resource name to use if a resource name contains no usable characters.</param>
 /// <param name="harvesterCore"></param>
 public IdentifierGenerator(string baseName, IHarvesterCore harvesterCore)
 {
     this.baseName            = baseName;
     this.maxLength           = IdentifierGenerator.MaxProductIdentifierLength;
     this.existingIdentifiers = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);
     this.possibleIdentifiers = new Dictionary <string, object>(StringComparer.OrdinalIgnoreCase);
     this.harvesterCore       = harvesterCore;
 }
Exemplo n.º 2
0
        public MSBuild14Project(IHarvesterCore harvesterCore, string configuration, string platform)
            : base(null, null, null, null)
        {
            this.buildParameters = new BuildParameters();

            try
            {
                HarvestLogger logger = new HarvestLogger();
                logger.HarvesterCore = harvesterCore;
                List <ILogger> loggers = new List <ILogger>();
                loggers.Add(logger);

                this.buildParameters.Loggers = loggers;

                // MSBuild can't handle storing operating environments for nested builds.
                if (Util.RunningInMsBuild)
                {
                    this.buildParameters.SaveOperatingEnvironment = false;
                }
            }
            catch (Exception e)
            {
                if (harvesterCore != null)
                {
                    harvesterCore.OnMessage(VSWarnings.NoLogger(e.Message));
                }
            }

            this.buildManager = new BuildManager();

            if (configuration != null || platform != null)
            {
                Dictionary <string, string> globalVariables = new Dictionary <string, string>();
                if (configuration != null)
                {
                    globalVariables.Add("Configuration", configuration);
                }

                if (platform != null)
                {
                    globalVariables.Add("Platform", platform);
                }

                this.projectCollection = new ProjectCollection(globalVariables);
            }
            else
            {
                this.projectCollection = new ProjectCollection();
            }
        }