Example #1
0
 internal SolutionConfigurationEntry(SolutionConfiguration parentConfig, SolutionConfigurationEntry other)
 {
     this.parentConfig  = parentConfig;
     this.itemId        = other.itemId;
     this.configuration = other.configuration;
     this.build         = other.build;
 }
        protected internal override void OnClean(IProgressMonitor monitor, ConfigurationSelector configuration)
        {
            if (ParentSolution == null)
            {
                return;
            }
            SolutionConfiguration conf = ParentSolution.GetConfiguration(configuration);

            if (conf == null)
            {
                return;
            }

            foreach (SolutionItem item in Items)
            {
                if (item is SolutionFolder)
                {
                    item.Clean(monitor, configuration);
                }
                else if (item is SolutionEntityItem)
                {
                    SolutionEntityItem         si = (SolutionEntityItem)item;
                    SolutionConfigurationEntry ce = conf.GetEntryForItem(si);
                    if (ce.Build)
                    {
                        si.Clean(monitor, ce.ItemConfigurationSelector);
                    }
                }
                else
                {
                    item.Clean(monitor, configuration);
                }
            }
        }
        public static void CheckBasicVsConsoleProject(Solution sol)
        {
            // Check projects

            Assert.AreEqual(1, sol.Items.Count);
            DotNetProject project = (DotNetProject)sol.Items [0];

            // Check files

            Assert.AreEqual(2, project.Files.Count);

            ProjectFile file = project.GetProjectFile(Path.Combine(project.BaseDirectory, "Program.cs"));

            Assert.AreEqual("Program.cs", Path.GetFileName(file.Name));
            Assert.AreEqual(BuildAction.Compile, file.BuildAction);

            file = project.GetProjectFile(Path.Combine(project.BaseDirectory, Path.Combine("Properties", "AssemblyInfo.cs")));
            Assert.AreEqual("AssemblyInfo.cs", Path.GetFileName(file.Name));
            Assert.AreEqual(BuildAction.Compile, file.BuildAction);

            // References

            Assert.AreEqual(3, project.References.Count);

            ProjectReference pr = project.References [0];

            Assert.AreEqual(ReferenceType.Package, pr.ReferenceType);
            Assert.AreEqual("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", pr.Reference);

            pr = project.References [1];
            Assert.AreEqual(ReferenceType.Package, pr.ReferenceType);
            Assert.AreEqual("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", pr.Reference);

            pr = project.References [2];
            Assert.AreEqual(ReferenceType.Package, pr.ReferenceType);
            Assert.AreEqual("System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", pr.Reference);

            // Configurations

            Assert.AreEqual(2, sol.Configurations.Count, "Configuration count");

            SolutionConfiguration sc = sol.Configurations [0];

            Assert.AreEqual("Debug", sc.Name);
            SolutionConfigurationEntry sce = sc.GetEntryForItem(project);

            Assert.IsTrue(sce.Build);
            Assert.AreEqual(project, sce.Item);
            Assert.AreEqual("Debug", sce.ItemConfiguration);

            sc = sol.Configurations [1];
            Assert.AreEqual("Release", sc.Name);
            sce = sc.GetEntryForItem(project);
            Assert.IsTrue(sce.Build);
            Assert.AreEqual(project, sce.Item);
            Assert.AreEqual("Release", sce.ItemConfiguration);
        }
Example #4
0
        public static void CheckBasicMdConsoleProject(Solution sol)
        {
            // Check projects

            Assert.AreEqual(1, sol.Items.Count);
            Assert.IsTrue(sol.Items [0] is DotNetProject, "Project is DotNetProject");
            DotNetProject project = (DotNetProject)sol.Items [0];

            Assert.AreEqual("csharp-console-mdp", project.Name);

            // Check files

            Assert.AreEqual(2, project.Files.Count, "File count");

            ProjectFile file = project.GetProjectFile(Path.Combine(project.BaseDirectory, "Main.cs"));

            Assert.AreEqual("Main.cs", Path.GetFileName(file.Name));
            Assert.AreEqual(BuildAction.Compile, file.BuildAction);

            file = project.GetProjectFile(Path.Combine(project.BaseDirectory, "AssemblyInfo.cs"));
            Assert.AreEqual("AssemblyInfo.cs", Path.GetFileName(file.Name));
            Assert.AreEqual(BuildAction.Compile, file.BuildAction);

            // References

            Assert.AreEqual(1, project.References.Count);
            ProjectReference pr = project.References [0];

            Assert.AreEqual(ReferenceType.Gac, pr.ReferenceType);
            Assert.AreEqual("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", pr.Reference);

            // Configurations

            Assert.AreEqual(2, sol.Configurations.Count, "Configuration count");

            SolutionConfiguration sc = sol.Configurations [0];

            Assert.AreEqual("Debug", sc.Id);
            SolutionConfigurationEntry sce = sc.GetEntryForItem(project);

            Assert.IsTrue(sce.Build);
            Assert.AreEqual(project, sce.Item);
            Assert.AreEqual("Debug", sce.ItemConfiguration);

            sc = sol.Configurations [1];
            Assert.AreEqual("Release", sc.Id);
            sce = sc.GetEntryForItem(project);
            Assert.IsTrue(sce.Build);
            Assert.AreEqual(project, sce.Item);
            Assert.AreEqual("Release2", sce.ItemConfiguration);
        }
        public SolutionConfigurationEntry AddItem(SolutionItem item, bool build, string itemConfiguration)
        {
            if (itemConfiguration == null)
            {
                itemConfiguration = Name;
            }
            SolutionConfigurationEntry conf = new SolutionConfigurationEntry(this, item);

            conf.Build             = build;
            conf.ItemConfiguration = itemConfiguration;
            configurations.Add(conf);
            if (parentSolution != null)
            {
                parentSolution.UpdateDefaultConfigurations();
            }
            return(conf);
        }
        protected override void OnClean(IProgressMonitor monitor, ConfigurationSelector configuration)
        {
            if (ParentSolution == null)
            {
                return;
            }
            SolutionConfiguration conf = ParentSolution.GetConfiguration(configuration);

            if (conf == null)
            {
                return;
            }

            try
            {
                monitor.BeginTask(GettextCatalog.GetString("Cleaning Solution: {0} ({1})", Name, configuration.ToString()), Items.Count);

                foreach (SolutionItem item in Items)
                {
                    if (item is SolutionFolder)
                    {
                        item.Clean(monitor, configuration);
                    }
                    else if (item is SolutionEntityItem)
                    {
                        SolutionEntityItem si = (SolutionEntityItem)item;
                        // ce can be null if you add items to the root solution folder which
                        // causes them to be placed in an autogenerated 'Project Items' folder
                        SolutionConfigurationEntry ce = conf.GetEntryForItem(si);
                        if (ce != null && ce.Build)
                        {
                            si.Clean(monitor, ce.ItemConfigurationSelector);
                        }
                    }
                    else
                    {
                        item.Clean(monitor, configuration);
                    }
                    monitor.Step(1);
                }
            }
            finally
            {
                monitor.EndTask();
            }
        }
Example #7
0
        protected override void OnClean(IProgressMonitor monitor, ConfigurationSelector configuration)
        {
            if (ParentSolution == null)
            {
                return;
            }
            SolutionConfiguration conf = ParentSolution.GetConfiguration(configuration);

            if (conf == null)
            {
                return;
            }

            try {
                monitor.BeginTask(GettextCatalog.GetString("Cleaning Solution {0}", Name), Items.Count);

                foreach (SolutionItem item in Items)
                {
                    if (item is SolutionFolder)
                    {
                        item.Clean(monitor, configuration);
                    }
                    else if (item is SolutionEntityItem)
                    {
                        SolutionEntityItem         si = (SolutionEntityItem)item;
                        SolutionConfigurationEntry ce = conf.GetEntryForItem(si);
                        if (ce.Build)
                        {
                            si.Clean(monitor, ce.ItemConfigurationSelector);
                        }
                    }
                    else
                    {
                        item.Clean(monitor, configuration);
                    }
                    monitor.Step(1);
                }
            }
            finally {
                monitor.EndTask();
            }
        }
		internal SolutionConfigurationEntry (SolutionConfiguration parentConfig, SolutionConfigurationEntry other)
		{
			this.parentConfig = parentConfig;
			this.itemId = other.itemId;
			this.configuration = other.configuration;
			this.build = other.build;
			this.deploy = other.deploy;
		}
		public SolutionConfigurationEntry AddItem (SolutionEntityItem item, bool build, string itemConfiguration)
		{
			if (itemConfiguration == null)
				itemConfiguration = Name;
			SolutionConfigurationEntry conf = new SolutionConfigurationEntry (this, item);
			conf.Build = build;
			conf.ItemConfiguration = itemConfiguration;
			configurations.Add (conf);
			if (parentSolution != null)
				parentSolution.UpdateDefaultConfigurations ();
			return conf;
		}