Наследование: Project, IAssemblyProject
        static void CheckConfigurationMappings(DotNetProject project, string currentConfig)
        {
            var projConfig = (DotNetProjectConfiguration)project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
            if (project.GetConfigurations ().Contains (currentConfig) && projConfig.Name != currentConfig)
                LogIssue (project, "configuration", currentConfig, projConfig.Name);

            if (currentConfig.IndexOf ("Debug", StringComparison.OrdinalIgnoreCase) != -1)
                return;

            // Fixup entries for release configs.
            var debugEntry = project.ParentSolution
                .GetConfiguration (new SolutionConfigurationSelector (currentConfig.Replace ("Release", "Debug")))
                .GetEntryForItem (project);
            if (debugEntry == null)
                return;

            IdeApp.Workspace.ActiveConfigurationId = currentConfig;

            var entry = project.ParentSolution.GetConfiguration (IdeApp.Workspace.ActiveConfiguration).GetEntryForItem (project);
            entry.Build = debugEntry.Build;
            entry.Deploy = debugEntry.Deploy;

            var newConfig = debugEntry.ItemConfiguration.Replace ("Debug", "Release");
            if (project.GetConfigurations ().Any (config => config == newConfig))
                entry.ItemConfiguration = newConfig;
            else {
                LogIssue (project, "configuration", newConfig, "Missing");
                entry.ItemConfiguration = debugEntry.ItemConfiguration;
            }
        }
Пример #2
0
		public NSObjectProjectInfo GetProjectInfo (DotNetProject project, IAssembly lookinAssembly = null)
		{
			var dom = TypeSystemService.GetProjectContentWrapper (project);
			project.ReferenceAddedToProject += HandleDomReferencesUpdated;
			project.ReferenceRemovedFromProject += HandleDomReferencesUpdated;
			return GetProjectInfo (dom, lookinAssembly);
		}
		public void Load (DotNetProject project, DotNetProjectConfiguration configuration)
		{
			this.project       = project;
			this.configuration = configuration;
			compileTargetCombo.Active          = configuration.CompileTarget == CompileTarget.Exe ? 0 : 1;
			checkbuttonIncludeDebugInfo.Active = configuration.DebugSymbols;
		}
		public void LoadConfigData (ProjectConfigurationPropertyPanel dlg)
		{	
			configuration = (DotNetProjectConfiguration) dlg.CurrentConfiguration;
			project = (DotNetProject) dlg.ConfiguredProject;
			compilerParameters = (JavaCompilerParameters) configuration.CompilationParameters;

			compileTargetCombo.Active = (int) configuration.CompileTarget;

			if (compilerParameters.Compiler == JavaCompiler.Javac)
				compilerJavacButton.Active = true;
			else
				compilerGcjButton.Active = true;

			enableOptimizationCheckButton.Active = compilerParameters.Optimize;
			generateDebugInformationCheckButton.Active = configuration.DebugMode;
			deprecationCheckButton.Active = compilerParameters.Deprecation;
			generateWarningsCheckButton.Active = compilerParameters.GenWarnings;
			warningsAsErrorsCheckButton.Active = !configuration.RunWithWarnings;
			
			compilerEntry.Text = compilerParameters.CompilerPath;
			classPathEntry.Text = compilerParameters.ClassPath;				
			mainClassEntry.Text = compilerParameters.MainClass;				
			symbolsEntry.Text = compilerParameters.DefineSymbols;	
			OnCompilerToggled (null, null);
		}
		public static IEnumerable<WebReferenceItem> GetWebReferenceItems (DotNetProject project)
		{
			foreach (WebReferenceItem item in WcfEngine.GetReferenceItems (project))
				yield return item;
			foreach (WebReferenceItem item in WsEngine.GetReferenceItems (project))
				yield return item;
		}
Пример #6
0
		public static NUnitProjectTestSuite CreateTest (DotNetProject project)
		{
			foreach (ProjectReference p in project.References)
				if (p.Reference.IndexOf ("nunit.framework") != -1 || p.Reference.IndexOf ("nunit.core") != -1)
					return new NUnitProjectTestSuite (project);
			return null;
		}
		public AddControllerDialog (DotNetProject project)
		{
			Build ();

			var ext = project.GetService<AspNetAppProjectFlavor> ();
			provider = project.LanguageBinding.GetCodeDomProvider ();

			loadedTemplateList = ext.GetCodeTemplates ("AddController");
			bool foundEmptyTemplate = false;
			int templateIndex = 0;
			foreach (string file in loadedTemplateList) {
				string name = System.IO.Path.GetFileNameWithoutExtension (file);
				templateCombo.AppendText (name);
				if (!foundEmptyTemplate) {
					if (name == "Empty") {
						templateCombo.Active = templateIndex;
						foundEmptyTemplate = true;
					} else
						templateIndex++;
				}
			}
			if (!foundEmptyTemplate)
				throw new Exception ("The Empty.tt template is missing.");

			nameEntry.Text = "Controller";
			nameEntry.Position = 0;

			Validate ();
		}
 public References(
     MD.DotNetProject project,
     IExtendedPackageManagementProjectService projectService)
 {
     this.msbuildProject = project;
     this.projectService = projectService;
 }
		public static NUnitProjectTestSuite CreateTest (DotNetProject project)
		{
			foreach (var p in project.References)
				if (p.Reference.IndexOf ("GuiUnit", StringComparison.OrdinalIgnoreCase) != -1 || p.Reference.IndexOf ("nunit.framework") != -1 || p.Reference.IndexOf ("nunit.core") != -1)
					return new NUnitProjectTestSuite (project);
			return null;
		}
		public RuntimeOptionsPanelWidget (DotNetProject project, IEnumerable<ItemConfiguration> configurations)
		{
			Build ();
			
			this.project = project;
			if (project != null) {
				// Get the list of available versions, and add only those supported by the target language.
				foreach (TargetFramework fx in Runtime.SystemAssemblyService.GetTargetFrameworks ()) {
					if (fx != project.TargetFramework) {
						if (!project.TargetRuntime.IsInstalled (fx))
							continue;
						if (!project.SupportsFramework (fx))
							continue;
					}
					runtimeVersionCombo.AppendText (fx.Name);
					if (project.TargetFramework == fx)
		 				runtimeVersionCombo.Active = supportedVersions.Count;
					supportedVersions.Add (fx);
				}
				if (supportedVersions.Count <= 1)
					Sensitive = false;
 			}
 			else
 				Sensitive = false;
		}
Пример #11
0
		public AddViewDialog (DotNetProject project)
		{
			this.project = project;
			aspFlavor = project.GetService<AspNetAppProjectFlavor> ();

			Build ();
			
			provider = project.LanguageBinding.GetCodeDomProvider ();

			var viewEngines = GetProperViewEngines ();
			loadedTemplateList = new Dictionary<string, IList<string>> ();
			foreach (var engine in viewEngines) {
				viewEngineCombo.AppendText (engine);
				loadedTemplateList[engine] = aspFlavor.GetCodeTemplates ("AddView", engine);
			}

			viewEngineCombo.Active = 0;
			InitializeTemplateStore (loadedTemplateList);

			ContentPlaceHolders = new List<string> ();
			string siteMaster = aspFlavor.VirtualToLocalPath ("~/Views/Shared/Site.master", null);
			if (project.Files.GetFile (siteMaster) != null)
				masterEntry.Text = "~/Views/Shared/Site.master";
			
			placeholderCombo.Model = primaryPlaceholderStore;
			
			UpdateTypePanelSensitivity (null, null);
			UpdateMasterPanelSensitivity (null, null);
			Validate ();
		}
Пример #12
0
 static void OnProjectAdded(DotNetProject project)
 {
     QyotoDesignInfo info = (QyotoDesignInfo)project.ExtendedProperties["QyotoDesignInfo"];
     if (info != null) {
         info.Project = project;
     }
 }
		void RefreshChildNodes (DotNetProject project)
		{
			ITreeBuilder builder = Context.GetTreeBuilder (project);
			if (builder != null) {
				builder.UpdateChildren ();
			}
		}
Пример #14
0
		public static BuildResult UpdateDesignerFile (
			CodeBehindWriter writer,
			DotNetProject project,
			ProjectFile file, ProjectFile designerFile
		)
		{
			var result = new BuildResult ();

			//parse the ASP.NET file
			var parsedDocument = TypeSystemService.ParseFile (project, file.FilePath).Result as WebFormsParsedDocument;
			if (parsedDocument == null) {
				result.AddError (string.Format ("Failed to parse file '{0}'", file.Name));
				return result;
			}

			//TODO: ensure type system is up to date

			CodeCompileUnit ccu;
			result.Append (GenerateCodeBehind (project, designerFile.FilePath, parsedDocument, out ccu));
			if (ccu != null) {
				writer.WriteFile (designerFile.FilePath, ccu);
			}

			return result;
		}
Пример #15
0
		public XcodeSyncBackContext (FilePath projectDir, Dictionary<string,DateTime> syncTimes,
			NSObjectInfoService infoService, DotNetProject project)
			: base (projectDir, syncTimes)
		{
			InfoService = infoService;
			Project = project;
		}
Пример #16
0
		/// <summary>
		/// Initializes a new instance of the <see cref="T:MonoDevelop.ConnectedServices.ConnectedService"/> class.
		/// </summary>
		protected ConnectedService (DotNetProject project)
		{
			this.Project = project;
			this.Dependencies = ConnectedServiceDependency.Empty;
			this.Sections = ConfigurationSection.Empty;
			this.DependenciesSection = new DependenciesSection (this);
		}
Пример #17
0
		public NodeEditorWidget (DotNetProject project, AddinRegistry reg, ExtensionNodeType ntype, AddinDescription parentAddinDescription, string parentPath, ExtensionNodeDescription node)
		{
			this.node = node;
			this.project = project;
			tips = new Tooltips ();
			Spacing = 0;
			
			// Header
			
			Label label = new Label ();
			label.Wrap = true;
			label.WidthRequest = 480;
			string txt = "<b>" + node.NodeName + "</b>";
			if (ntype.Description.Length > 0)
				txt += "\n" + GLib.Markup.EscapeText (ntype.Description);
			label.Markup = txt;
			label.Xalign = 0f;
			PackStart (label, false, false, 6);
			PackStart (new HSeparator (), false, false, 0);
			
			// Attributes
			
			grid = new PropertyGrid ();
			grid.CurrentObject = new NodeWrapper (project, reg, ntype, parentAddinDescription, parentPath, node);
			
			PackStart (grid, true, true, 0);
			
			ShowAll ();
			
			grid.ShowHelp = true;
			grid.ShowToolbar = false;
			
		}
Пример #18
0
		public SelectNodeSetDialog (DotNetProject project, AddinRegistry registry, AddinDescription desc)
		{
			this.Build();
			this.project = project;
			this.registry = registry;
			this.desc = desc;
			
			foreach (AddinDependency adep in desc.MainModule.Dependencies) {
				Addin addin = registry.GetAddin (adep.FullAddinId);
				if (addin != null && addin.Description != null) {
					foreach (ExtensionNodeSet ns in addin.Description.ExtensionNodeSets) {
						combo.AppendText (ns.Id);
						sets [ns.Id] = ns;
					}
				}
			}
			
			foreach (ExtensionNodeSet ns in desc.ExtensionNodeSets) {
				combo.AppendText (ns.Id);
				sets [ns.Id] = ns;
			}
			
			nodeseteditor.AllowEditing = false;
			buttonOk.Sensitive = false;
		}
		public Project (DotNetProject project)
			: this (
				project,
				PackageManagementExtendedServices.ProjectService,
				new PackageManagementFileService ())
		{
		}
Пример #20
0
        protected SolutionItemConfiguration CreateConfigurationBlock(MonoDevelop.Projects.DotNetProject project, Config ConfigBlock, string AssemblyName, string OuputType, IProgressMonitor monitor)
        {
            DotNetProjectConfiguration confObj = project.CreateConfiguration(ConfigBlock.Name) as DotNetProjectConfiguration;

            confObj.RunWithWarnings = false;
            confObj.DebugMode       = ConfigBlock.DebugSymbols;
            project.CompileTarget   = (CompileTarget)Enum.Parse(typeof(CompileTarget), OuputType, true);

            string dir = MapPath(project.BaseDirectory, ConfigBlock.OutputPath);

            if (dir == null)
            {
                dir = Path.Combine("bin", ConfigBlock.Name);
                monitor.ReportWarning(string.Format(GettextCatalog.GetString("Output directory '{0}' can't be mapped to a local directory. The directory '{1}' will be used instead"), ConfigBlock.OutputPath, dir));
            }
            confObj.OutputDirectory = dir;
            confObj.OutputAssembly  = AssemblyName;

            CSharpCompilerParameters compilerParams = new CSharpCompilerParameters();

            compilerParams.WarningLevel           = ConfigBlock.WarningLevel;
            compilerParams.NoWarnings             = "";
            compilerParams.Optimize               = ConfigBlock.Optimize;
            compilerParams.DefineSymbols          = ConfigBlock.DefineConstants;
            compilerParams.UnsafeCode             = ConfigBlock.AllowUnsafeBlocks;
            compilerParams.GenerateOverflowChecks = ConfigBlock.CheckForOverflowUnderflow;

            return(confObj);
        }
Пример #21
0
		public MonoSolutionItemHandler (DotNetProject project)
		{
			this.project = project;
			project.FileAddedToProject += OnFileAddedToProject;
			project.FileRemovedFromProject += OnFileRemovedFromProject;
			project.FileRenamedInProject += OnFileRenamedInProject;
		}
		public ProjectReferencesFromPackagesFolderNode (
			DotNetProject project,
			ProjectReferenceCollection projectReferences)
		{
			Project = project;
			References = projectReferences;
		}
		public References (
			MD.DotNetProject project,
			IExtendedPackageManagementProjectService projectService)
		{
			this.msbuildProject = project;
			this.projectService = projectService;
		}
        public CompilerOptionsPanelWidget(DotNetProject project)
        {
            this.Build();
            this.project = project;
            DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) project.GetActiveConfiguration (IdeApp.Workspace.ActiveConfiguration);
            FSharpCompilerParameters compilerParameters = (FSharpCompilerParameters) configuration.CompilationParameters;

            ListStore store = new ListStore (typeof (string));
            store.AppendValues (GettextCatalog.GetString ("Executable"));
            store.AppendValues (GettextCatalog.GetString ("Library"));
            store.AppendValues (GettextCatalog.GetString ("Executable with GUI"));
            store.AppendValues (GettextCatalog.GetString ("Module"));
            compileTargetCombo.Model = store;
            CellRendererText cr = new CellRendererText ();
            compileTargetCombo.PackStart (cr, true);
            compileTargetCombo.AddAttribute (cr, "text", 0);
            compileTargetCombo.Active = (int) configuration.CompileTarget;
            compileTargetCombo.Changed += new EventHandler (OnTargetChanged);

            // Load the codepage. If it matches any of the supported encodigs, use the encoding name
            string foundEncoding = null;
            foreach (TextEncoding e in TextEncoding.SupportedEncodings) {
                if (e.CodePage == -1)
                    continue;
                if (e.CodePage == compilerParameters.CodePage)
                    foundEncoding = e.Id;
                codepageEntry.AppendText (e.Id);
            }
            if (foundEncoding != null)
                codepageEntry.Entry.Text = foundEncoding;
            else if (compilerParameters.CodePage != 0)
                codepageEntry.Entry.Text = compilerParameters.CodePage.ToString ();
        }
Пример #25
0
		public GuiBuilderProject (DotNetProject project, string fileName)
		{
			this.fileName = fileName;
			this.project = project;
			Counters.GuiProjectsLoaded++;
			GuiBuilderService.NotifyGuiProjectLoaded ();
		}
		public NuGetProject CreateNuGetProject (DotNetProject project, INuGetProjectContext context)
		{
			Runtime.AssertMainThread ();

			var nugetAwareProject = project as INuGetAwareProject;
			if (nugetAwareProject != null)
				return nugetAwareProject.CreateNuGetProject ();

			var projectSystem = new MonoDevelopMSBuildNuGetProjectSystem (project, context);

			string projectJsonPath = ProjectJsonPathUtilities.GetProjectConfigPath (project.BaseDirectory, project.Name);

			if (File.Exists (projectJsonPath)) {
				return new BuildIntegratedProjectSystem (
					projectJsonPath,
					project.FileName,
					project,
					projectSystem,
					project.Name,
					settings);
			}

			string baseDirectory = GetBaseDirectory (project);
			string folderNuGetProjectFullPath = PackagesFolderPathUtility.GetPackagesFolderPath (baseDirectory, settings);

			string packagesConfigFolderPath = project.BaseDirectory;

			return new MSBuildNuGetProject (
				projectSystem, 
				folderNuGetProjectFullPath, 
				packagesConfigFolderPath);
		}
		public CompilerOptionsPanelWidget (DotNetProject project)
		{
			this.Build();
			this.project = project;
			DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) project.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
			CSharpCompilerParameters compilerParameters = (CSharpCompilerParameters) configuration.CompilationParameters;
			CSharpProjectParameters projectParameters = (CSharpProjectParameters) configuration.ProjectParameters;
			
			ListStore store = new ListStore (typeof (string));
			store.AppendValues (GettextCatalog.GetString ("Executable"));
			store.AppendValues (GettextCatalog.GetString ("Library"));
			store.AppendValues (GettextCatalog.GetString ("Executable with GUI"));
			store.AppendValues (GettextCatalog.GetString ("Module"));
			compileTargetCombo.Model = store;
			CellRendererText cr = new CellRendererText ();
			compileTargetCombo.PackStart (cr, true);
			compileTargetCombo.AddAttribute (cr, "text", 0);
			compileTargetCombo.Active = (int) configuration.CompileTarget;
			compileTargetCombo.Changed += new EventHandler (OnTargetChanged);
			
			if (project.IsLibraryBasedProjectType) {
				//fixme: should we totally hide these?
				compileTargetCombo.Sensitive = false;
				mainClassEntry.Sensitive = false;
			} else {
				classListStore = new ListStore (typeof(string));
				mainClassEntry.Model = classListStore;
				mainClassEntry.TextColumn = 0;
				((Entry)mainClassEntry.Child).Text = projectParameters.MainClass ?? string.Empty;
			
				UpdateTarget ();
			}
			
			// Load the codepage. If it matches any of the supported encodigs, use the encoding name 			
			string foundEncoding = null;
			foreach (TextEncoding e in TextEncoding.SupportedEncodings) {
				if (e.CodePage == -1)
					continue;
				if (e.CodePage == projectParameters.CodePage)
					foundEncoding = e.Id;
				codepageEntry.AppendText (e.Id);
			}
			if (foundEncoding != null)
				codepageEntry.Entry.Text = foundEncoding;
			else if (projectParameters.CodePage != 0)
				codepageEntry.Entry.Text = projectParameters.CodePage.ToString ();
			
			iconEntry.Path = projectParameters.Win32Icon;
			iconEntry.DefaultPath = project.BaseDirectory;
			allowUnsafeCodeCheckButton.Active = compilerParameters.UnsafeCode;
			noStdLibCheckButton.Active = compilerParameters.NoStdLib;

			ListStore langVerStore = new ListStore (typeof (string));
			langVerStore.AppendValues (GettextCatalog.GetString ("Default"));
			langVerStore.AppendValues ("ISO-1");
			langVerStore.AppendValues ("ISO-2");
			langVerCombo.Model = langVerStore;
			langVerCombo.Active = (int) compilerParameters.LangVersion;
		}
Пример #28
0
//		internal static ProjectItem FindByEntity (IProject project, IEntity entity)
//		{
//			if (entity.Region.FileName != null) {
//				return FindByFileName (project, entity.Region.FileName);
//			}
//			return null;
//		}

        internal static ProjectItem FindByFileName(MD.DotNetProject project, string fileName)
        {
//			MD.ProjectFile item = project.FindFile (new FileName (fileName));
//			if (item != null) {
//				return new ProjectItem (new Project (project), item);
//			}
            return(null);
        }
		public IMonoDevelopPackageManager CreatePackageManager (
			IPackageRepository sourceRepository,
			DotNetProject project)
		{
			IMonoDevelopPackageManager packageManager = factory.CreatePackageManager (sourceRepository, project);
			ProjectManager = packageManager.ProjectManager;
			return packageManager;
		}
		/// <summary>Initializes a new instance of the WebReferenceItem class.</summary>
		/// <param name="name">A string containing the name for the web reference.</param>
		public WebReferenceItem (WebServiceEngine engine, DotNetProject project, string name, FilePath basePath, ProjectFile mapFile)
		{
			this.engine = engine;
			this.name = name;
			this.project = project;
			this.mapFile = mapFile;
			BasePath = basePath.CanonicalPath;
		}
Пример #31
0
 public static bool SupportsRefactoring(DotNetProject project)
 {
     if (project == null || project.LanguageBinding == null || project.LanguageBinding.GetCodeDomProvider () == null)
         return false;
     RefactorOperations ops = RefactorOperations.AddField | RefactorOperations.AddMethod | RefactorOperations.RenameField | RefactorOperations.AddAttribute;
     CodeRefactorer cref = IdeApp.Workspace.GetCodeRefactorer (project.ParentSolution);
     return cref.LanguageSupportsOperation (project.LanguageBinding.Language, ops);
 }
		public override void Initialize (OptionsDialog dialog, object dataObject)
		{
			project = dataObject as DotNetProject;
			propertyGroup = project.MSBuildProject.GetNuGetMetadataPropertyGroup ();
			packOnBuild = propertyGroup.GetValue ("PackOnBuild", false);

			base.Initialize (dialog, dataObject);
		}
Пример #33
0
		public XcodeProjectTracker (DotNetProject dnp, NSObjectInfoService infoService)
		{
			if (dnp == null)
				throw new ArgumentNullException ("dnp");
			this.dnp = dnp;
			this.infoService = infoService;
			AppleSdkSettings.Changed += DisableSyncing;
		}
Пример #34
0
            public async Task GetTypes(MonoDevelop.Projects.DotNetProject project)
            {
                TypeNamesList = new List <string> ();
                var ctx = await IdeApp.TypeSystemService.GetCompilationAsync(project);

                TypesList = new List <INamedTypeSymbol> (ctx.GetAllTypesInMainAssembly());
                foreach (var typeDef in TypesList)
                {
                    TypeNamesList.Add(Ambience.EscapeText(typeDef.ToDisplayString(SymbolDisplayFormat.CSharpErrorMessageFormat)));
                }
            }
        internal static string GetProjectKind(MD.DotNetProject project)
        {
            string type = ProjectType.GetProjectType(project);

            if (type == ProjectType.CSharp)
            {
                return(CSharp);
            }
            else if (type == ProjectType.VB)
            {
                return(VBNet);
            }
            return(string.Empty);
        }
Пример #36
0
        void RegisterReference(MonoDevelop.Projects.DotNetProject project)
        {
            var dnp = project;
            var pr  = base.Type.GetProjectReference();

            //add the reference if it doesn't match an existing one
            bool match = false;

            foreach (var p in dnp.References)
            {
                if (p.Equals(pr))
                {
                    match = true;
                }
            }
            if (!match)
            {
                dnp.References.Add(pr);
            }
        }
Пример #37
0
        void PopulateSupportFileList(FileCopySet list, ConfigurationSelector configuration, int referenceDistance)
        {
            if (referenceDistance < 2)
            {
                base.PopulateSupportFileList(list, configuration);
            }

            //rename the app.config file
            FileCopySet.Item appConfig = list.Remove("app.config");
            if (appConfig == null)
            {
                appConfig = list.Remove("App.config");
            }
            if (appConfig != null)
            {
                string output = Path.GetFileName(GetOutputFileName(configuration));
                list.Add(appConfig.Src, appConfig.CopyOnlyIfNewer, output + ".config");
            }

            //collect all the "local copy" references and their attendant files
            foreach (ProjectReference projectReference in References)
            {
                if (!projectReference.LocalCopy || ParentSolution == null)
                {
                    continue;
                }

                if (projectReference.ReferenceType == ReferenceType.Project)
                {
                    DotNetProject p = ParentSolution.FindProjectByName(projectReference.Reference) as DotNetProject;

                    if (p == null)
                    {
                        LoggingService.LogWarning("Project '{0}' referenced from '{1}' could not be found", projectReference.Reference, this.Name);
                        continue;
                    }

                    string refOutput = p.GetOutputFileName(configuration);
                    if (string.IsNullOrEmpty(refOutput))
                    {
                        LoggingService.LogWarning("Project '{0}' referenced from '{1}' has an empty output filename", p.Name, this.Name);
                        continue;
                    }

                    list.Add(refOutput);

                    //VS COMPAT: recursively copy references's "local copy" files
                    //but only copy the "copy to output" files from the immediate references
                    p.PopulateSupportFileList(list, configuration, referenceDistance + 1);

                    DotNetProjectConfiguration refConfig = p.GetConfiguration(configuration) as DotNetProjectConfiguration;

                    if (refConfig != null && refConfig.DebugMode)
                    {
                        string mdbFile = TargetRuntime.GetAssemblyDebugInfoFile(refOutput);
                        if (File.Exists(mdbFile))
                        {
                            list.Add(mdbFile);
                        }
                    }
                }
                else if (projectReference.ReferenceType == ReferenceType.Assembly)
                {
                    // VS COMPAT: Copy the assembly, but also all other assemblies referenced by it
                    // that are located in the same folder
                    foreach (string file in GetAssemblyRefsRec(projectReference.Reference, new HashSet <string> ()))
                    {
                        list.Add(file);
                        if (File.Exists(file + ".config"))
                        {
                            list.Add(file + ".config");
                        }
                        string mdbFile = TargetRuntime.GetAssemblyDebugInfoFile(file);
                        if (File.Exists(mdbFile))
                        {
                            list.Add(mdbFile);
                        }
                    }
                }
                else if (projectReference.ReferenceType == ReferenceType.Custom)
                {
                    foreach (string refFile in projectReference.GetReferencedFileNames(configuration))
                    {
                        list.Add(refFile);
                    }
                }
            }
        }
Пример #38
0
        public async Task MakefileSynchronization()
        {
            if (Platform.IsWindows)
            {
                Assert.Ignore();
            }

            string   solFile = Util.GetSampleProject("console-project-with-makefile", "ConsoleProject.sln");
            Solution sol     = (Solution)await Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), solFile);

            DotNetProject p = (DotNetProject)sol.Items [0];

            Assert.AreEqual(2, p.Files.Count);
            string f = Path.Combine(p.BaseDirectory, "Program.cs");

            Assert.IsTrue(p.Files.GetFile(f) != null, "Contains Program.cs");
            f = Path.Combine(p.BaseDirectory, "Properties");
            f = Path.Combine(f, "AssemblyInfo.cs");
            Assert.IsTrue(p.Files.GetFile(f) != null, "Contains Properties/AssemblyInfo.cs");

            List <string> refs = new List <string> ();

            refs.Add("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
            refs.Add("System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
            refs.Add("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
            Assert.AreEqual(3, p.References.Count);

            ProjectReference xmlRef = null;

            foreach (ProjectReference pref in p.References)
            {
                Assert.IsTrue(refs.Contains(pref.Reference), "Contains reference " + pref.Reference);
                refs.Remove(pref.Reference);
                if (pref.Reference.StartsWith("System.Xml"))
                {
                    xmlRef = pref;
                }
            }

            // Test saving

            p.References.Remove(xmlRef);
            p.References.Add(ProjectReference.CreateAssemblyReference("System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"));

            p.Files.Remove(f);
            p.Files.Add(new ProjectFile(Path.Combine(p.BaseDirectory, "Class1.cs"), BuildAction.Compile));

            await sol.SaveAsync(Util.GetMonitor());

            string makefile = File.ReadAllText(Path.Combine(p.BaseDirectory, "Makefile"));

            string[] values = GetVariable(makefile, "FILES").Split(' ');
            Assert.AreEqual(2, values.Length);
            Assert.AreEqual("Class1.cs", values [0]);
            Assert.AreEqual("Program.cs", values [1]);

            values = GetVariable(makefile, "REFERENCES").Split(' ');
            Assert.AreEqual(3, values.Length);
            Assert.AreEqual("System", values [0]);
            Assert.AreEqual("System.Data", values [1]);
            Assert.AreEqual("System.Web", values [2]);

            sol.Dispose();
        }
Пример #39
0
 string GetConfigFolderName(DotNetProject lib, string conf)
 {
     return(Path.GetFileName(Path.GetDirectoryName(lib.GetOutputFileName((SolutionConfigurationSelector)conf))));
 }
Пример #40
0
        public async Task BuildingAndCleaningSolution()
        {
            string solFile = Util.GetSampleProject("console-with-libs", "console-with-libs.sln");

            Solution sol = (Solution)await Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), solFile);

            DotNetProject p    = (DotNetProject)sol.FindProjectByName("console-with-libs");
            DotNetProject lib1 = (DotNetProject)sol.FindProjectByName("library1");
            DotNetProject lib2 = (DotNetProject)sol.FindProjectByName("library2");

            SolutionFolder folder = new SolutionFolder();

            folder.Name = "subfolder";
            sol.RootFolder.Items.Add(folder);
            sol.RootFolder.Items.Remove(lib2);
            folder.Items.Add(lib2);

            Workspace ws = new Workspace();

            ws.FileName = Path.Combine(sol.BaseDirectory, "workspace");
            ws.Items.Add(sol);
            await ws.SaveAsync(Util.GetMonitor());

            // Build the project and the references

            BuildResult res = await ws.Build(Util.GetMonitor(), ConfigurationSelector.Default);

            Assert.AreEqual(0, res.ErrorCount);
            Assert.AreEqual(0, res.WarningCount);
            Assert.AreEqual(3, res.BuildCount);

            Assert.IsTrue(File.Exists(Util.Combine(p.BaseDirectory, "bin", "Debug", "console-with-libs.exe")));
            Assert.IsTrue(File.Exists(Util.Combine(p.BaseDirectory, "bin", "Debug", GetMdb(p, "console-with-libs.exe"))));
            Assert.IsTrue(File.Exists(Util.Combine(lib1.BaseDirectory, "bin", "Debug", "library1.dll")));
            Assert.IsTrue(File.Exists(Util.Combine(lib1.BaseDirectory, "bin", "Debug", GetMdb(lib1, "library1.dll"))));
            Assert.IsTrue(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", "library2.dll")));
            Assert.IsTrue(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", GetMdb(lib2, "library2.dll"))));

            // Clean the workspace

            await ws.Clean(Util.GetMonitor(), ConfigurationSelector.Default);

            Assert.IsFalse(File.Exists(Util.Combine(p.BaseDirectory, "bin", "Debug", "console-with-libs.exe")));
            Assert.IsFalse(File.Exists(Util.Combine(p.BaseDirectory, "bin", "Debug", GetMdb(p, "console-with-libs.exe"))));
            Assert.IsFalse(File.Exists(Util.Combine(lib1.BaseDirectory, "bin", "Debug", "library1.dll")));
            Assert.IsFalse(File.Exists(Util.Combine(lib1.BaseDirectory, "bin", "Debug", GetMdb(lib1, "library1.dll"))));
            Assert.IsFalse(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", "library2.dll")));
            Assert.IsFalse(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", GetMdb(lib2, "library2.dll"))));

            // Build the solution

            res = await ws.Build(Util.GetMonitor(), ConfigurationSelector.Default);

            Assert.AreEqual(0, res.ErrorCount);
            Assert.AreEqual(0, res.WarningCount);
            Assert.AreEqual(3, res.BuildCount);

            Assert.IsTrue(File.Exists(Util.Combine(p.BaseDirectory, "bin", "Debug", "console-with-libs.exe")));
            Assert.IsTrue(File.Exists(Util.Combine(p.BaseDirectory, "bin", "Debug", GetMdb(p, "console-with-libs.exe"))));
            Assert.IsTrue(File.Exists(Util.Combine(lib1.BaseDirectory, "bin", "Debug", "library1.dll")));
            Assert.IsTrue(File.Exists(Util.Combine(lib1.BaseDirectory, "bin", "Debug", GetMdb(lib1, "library1.dll"))));
            Assert.IsTrue(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", "library2.dll")));
            Assert.IsTrue(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", GetMdb(lib2, "library2.dll"))));

            // Clean the solution

            await sol.Clean(Util.GetMonitor(), "Debug");

            Assert.IsFalse(File.Exists(Util.Combine(p.BaseDirectory, "bin", "Debug", "console-with-libs.exe")));
            Assert.IsFalse(File.Exists(Util.Combine(p.BaseDirectory, "bin", "Debug", GetMdb(p, "console-with-libs.exe"))));
            Assert.IsFalse(File.Exists(Util.Combine(lib1.BaseDirectory, "bin", "Debug", "library1.dll")));
            Assert.IsFalse(File.Exists(Util.Combine(lib1.BaseDirectory, "bin", "Debug", GetMdb(lib1, "library1.dll"))));
            Assert.IsFalse(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", "library2.dll")));
            Assert.IsFalse(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", GetMdb(lib2, "library2.dll"))));

            // Build the solution folder

            res = await folder.Build(Util.GetMonitor(), (SolutionConfigurationSelector)"Debug");

            Assert.AreEqual(0, res.ErrorCount);
            Assert.AreEqual(0, res.WarningCount);
            Assert.AreEqual(1, res.BuildCount);

            Assert.IsFalse(File.Exists(Util.Combine(p.BaseDirectory, "bin", "Debug", "console-with-libs.exe")));
            Assert.IsFalse(File.Exists(Util.Combine(p.BaseDirectory, "bin", "Debug", GetMdb(p, "console-with-libs.exe"))));
            Assert.IsFalse(File.Exists(Util.Combine(lib1.BaseDirectory, "bin", "Debug", "library1.dll")));
            Assert.IsFalse(File.Exists(Util.Combine(lib1.BaseDirectory, "bin", "Debug", GetMdb(lib1, "library1.dll"))));
            Assert.IsTrue(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", "library2.dll")));
            Assert.IsTrue(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", GetMdb(lib2, "library2.dll"))));

            // Clean the solution folder

            await folder.Clean(Util.GetMonitor(), (SolutionConfigurationSelector)"Debug");

            Assert.IsFalse(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", "library2.dll")));
            Assert.IsFalse(File.Exists(Util.Combine(lib2.BaseDirectory, "bin", "Debug", GetMdb(lib2, "library2.dll"))));
            sol.Dispose();
        }
Пример #41
0
        public async Task RefreshReferences()
        {
            string solFile = Util.GetSampleProject("reference-refresh", "ConsoleProject.sln");

            Solution sol = (Solution)await Services.ProjectService.ReadWorkspaceItem(Util.GetMonitor(), solFile);

            DotNetProject project = sol.GetAllItems <DotNetProject> ().FirstOrDefault();

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

            ProjectReference r;

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("System,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("System.Xml,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference == "test");
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Assembly);
            Assert.AreEqual(r.GetReferencedFileNames(project.DefaultConfiguration.Selector).Single(), project.BaseDirectory.Combine("test.dll").FullPath.ToString());
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference == "gtk-sharp");
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Assembly);
            Assert.AreEqual(r.GetReferencedFileNames(project.DefaultConfiguration.Selector).Single(), project.BaseDirectory.Combine("gtk-sharp.dll").FullPath.ToString());
            Assert.IsTrue(r.IsValid);

            // Refresh without any change

            project.RefreshReferenceStatus();

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

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("System,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("System.Xml,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference == "test");
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Assembly);
            Assert.AreEqual(r.GetReferencedFileNames(project.DefaultConfiguration.Selector).Single(), project.BaseDirectory.Combine("test.dll").FullPath.ToString());
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference == "gtk-sharp");
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Assembly);
            Assert.AreEqual(r.GetReferencedFileNames(project.DefaultConfiguration.Selector).Single(), project.BaseDirectory.Combine("gtk-sharp.dll").FullPath.ToString());
            Assert.IsTrue(r.IsValid);

            // Refresh after deleting test.dll

            File.Move(project.BaseDirectory.Combine("test.dll"), project.BaseDirectory.Combine("test.dll.tmp"));
            project.RefreshReferenceStatus();

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

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("System,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("System.Xml,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference == "test");
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsFalse(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference == "gtk-sharp");
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Assembly);
            Assert.AreEqual(r.GetReferencedFileNames(project.DefaultConfiguration.Selector).Single(), project.BaseDirectory.Combine("gtk-sharp.dll").FullPath.ToString());
            Assert.IsTrue(r.IsValid);

            // Refresh after deleting gtk-sharp.dll

            File.Move(project.BaseDirectory.Combine("gtk-sharp.dll"), project.BaseDirectory.Combine("gtk-sharp.dll.tmp"));
            project.RefreshReferenceStatus();

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

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("System,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("System.Xml,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference == "test");
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsFalse(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("gtk-sharp,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.AreEqual("gtk-sharp.dll", Path.GetFileName(r.GetReferencedFileNames(project.DefaultConfiguration.Selector).Single()));
            Assert.IsTrue(r.IsValid);

            // Refresh after restoring gtk-sharp.dll and test.dll

            File.Move(project.BaseDirectory.Combine("test.dll.tmp"), project.BaseDirectory.Combine("test.dll"));
            File.Move(project.BaseDirectory.Combine("gtk-sharp.dll.tmp"), project.BaseDirectory.Combine("gtk-sharp.dll"));
            project.RefreshReferenceStatus();

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

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("System,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("System.Xml,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Package);
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference == "test");
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Assembly);
            Assert.AreEqual(r.GetReferencedFileNames(project.DefaultConfiguration.Selector).Single(), project.BaseDirectory.Combine("test.dll").FullPath.ToString());
            Assert.IsTrue(r.IsValid);

            r = project.References.FirstOrDefault(re => re.Reference.StartsWith("gtk-sharp,"));
            Assert.IsNotNull(r);
            Assert.AreEqual(r.ReferenceType, ReferenceType.Assembly);
            Assert.AreEqual(r.GetReferencedFileNames(project.DefaultConfiguration.Selector).Single(), project.BaseDirectory.Combine("gtk-sharp.dll").FullPath.ToString());
            Assert.IsTrue(r.IsValid);
        }
Пример #42
0
 internal protected virtual bool OnGetCanReferenceProject(DotNetProject targetProject, out string reason)
 {
     return(next.OnGetCanReferenceProject(targetProject, out reason));
 }
Пример #43
0
 public override IEnumerable <string> GetReferencedAssemblies(DotNetProject project, ConfigurationSelector configuration, bool includeProjectReferences)
 {
     return(project.OnGetReferencedAssemblies(configuration, includeProjectReferences));
 }
Пример #44
0
        public static void CheckResourcesSolution(Solution sol)
        {
            DotNetProject p = (DotNetProject)sol.Items [0];

            Assert.AreEqual("ResourcesTesterNamespace", p.DefaultNamespace);

            string      f  = Path.Combine(p.BaseDirectory, "Bitmap1.bmp");
            ProjectFile pf = p.Files.GetFile(f);

            Assert.IsNotNull(pf, "Bitmap1.bmp not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTesterNamespace.Bitmap1.bmp", pf.ResourceId);

            f  = Path.Combine(p.BaseDirectory, "BitmapCultured.ca.bmp");
            pf = p.Files.GetFile(f);
            Assert.IsNotNull(pf, "BitmapCultured.ca.bmp not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTesterNamespace.BitmapCultured.bmp", pf.ResourceId);

            f  = Path.Combine(p.BaseDirectory, "Cultured.ca.resx");
            pf = p.Files.GetFile(f);
            Assert.IsNotNull(pf, "Cultured.ca.resx not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTesterNamespace.Cultured.ca.resources", pf.ResourceId);

            f  = Path.Combine(p.BaseDirectory, "FormFile.ca.resx");
            pf = p.Files.GetFile(f);
            Assert.IsNotNull(pf, "FormFile.ca.resx not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTester.Form1.ca.resources", pf.ResourceId);

            f  = Path.Combine(p.BaseDirectory, "FormFile.resx");
            pf = p.Files.GetFile(f);
            Assert.IsNotNull(pf, "FormFile.resx not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTester.Form1.resources", pf.ResourceId);

            f  = Path.Combine(p.BaseDirectory, "Normal.resx");
            pf = p.Files.GetFile(f);
            Assert.IsNotNull(pf, "Normal.resx not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTesterNamespace.Normal.resources", pf.ResourceId);

            string subdir = Path.Combine(p.BaseDirectory, "Subfolder");

            f  = Path.Combine(subdir, "Bitmap2.bmp");
            pf = p.Files.GetFile(f);
            Assert.IsNotNull(pf, "Subfolder/Bitmap2.bmp not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTesterNamespace.Subfolder.Bitmap2.bmp", pf.ResourceId);

            f  = Path.Combine(subdir, "BitmapCultured2.ca.bmp");
            pf = p.Files.GetFile(f);
            Assert.IsNotNull(pf, "Subfolder/BitmapCultured2.ca.bmp not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTesterNamespace.Subfolder.BitmapCultured2.bmp", pf.ResourceId);

            f  = Path.Combine(subdir, "Cultured2.ca.resx");
            pf = p.Files.GetFile(f);
            Assert.IsNotNull(pf, "Subfolder/Cultured2.ca.resx not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTesterNamespace.Subfolder.Cultured2.ca.resources", pf.ResourceId);

            f  = Path.Combine(subdir, "FormFile2.ca.resx");
            pf = p.Files.GetFile(f);
            Assert.IsNotNull(pf, "Subfolder/FormFile2.ca.resx not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTester.Form2.ca.resources", pf.ResourceId);

            f  = Path.Combine(subdir, "FormFile2.resx");
            pf = p.Files.GetFile(f);
            Assert.IsNotNull(pf, "Subfolder/FormFile2.resx not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTester.Form2.resources", pf.ResourceId);

            f  = Path.Combine(subdir, "Normal2.resx");
            pf = p.Files.GetFile(f);
            Assert.IsNotNull(pf, "Subfolder/Normal2.resx not found");
            Assert.AreEqual(BuildAction.EmbeddedResource, pf.BuildAction);
            Assert.AreEqual("ResourcesTesterNamespace.Subfolder.Normal2.resources", pf.ResourceId);
        }
Пример #45
0
 internal void SetOwnerProject(DotNetProject project)
 {
     ownerProject = project;
     UpdatePackageReference();
 }
Пример #46
0
        public static Solution CreateProjectWithFolders(string hint)
        {
            string dir = Util.CreateTmpDir(hint);

            Directory.CreateDirectory(Util.Combine(dir, "console-project"));
            Directory.CreateDirectory(Util.Combine(dir, "nested-solution1"));
            Directory.CreateDirectory(Util.Combine(dir, "nested-solution1", "library1"));
            Directory.CreateDirectory(Util.Combine(dir, "nested-solution1", "library2"));
            Directory.CreateDirectory(Util.Combine(dir, "nested-solution2"));
            Directory.CreateDirectory(Util.Combine(dir, "nested-solution2", "console-project2"));
            Directory.CreateDirectory(Util.Combine(dir, "nested-solution2", "nested-solution3"));
            Directory.CreateDirectory(Util.Combine(dir, "nested-solution2", "nested-solution3", "library3"));
            Directory.CreateDirectory(Util.Combine(dir, "nested-solution2", "nested-solution3", "library4"));

            Solution sol = new Solution();

            sol.FileName = Path.Combine(dir, "nested-solutions-mdp");
            SolutionConfiguration scDebug   = sol.AddConfiguration("Debug", true);
            SolutionConfiguration scRelease = sol.AddConfiguration("Release", true);

            DotNetProject project1 = CreateProject(Util.Combine(dir, "console-project"), "C#", "console-project");

            project1.Files.Add(new ProjectFile(Path.Combine(project1.BaseDirectory, "Program.cs")));
            project1.Files.Add(new ProjectFile(Path.Combine(project1.BaseDirectory, "Properties", "AssemblyInfo.cs")));
            sol.RootFolder.Items.Add(project1);

            // nested-solution1

            SolutionFolder folder1 = new SolutionFolder();

            sol.RootFolder.Items.Add(folder1);
            folder1.Name = "nested-solution1";

            DotNetProject projectLib1 = CreateProject(Util.Combine(dir, "nested-solution1", "library1"), "C#", "library1");

            projectLib1.References.Add(new ProjectReference(ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
            projectLib1.Files.Add(new ProjectFile(Path.Combine(projectLib1.BaseDirectory, "MyClass.cs")));
            projectLib1.Files.Add(new ProjectFile(Path.Combine(projectLib1.BaseDirectory, "Properties", "AssemblyInfo.cs")));
            projectLib1.CompileTarget = CompileTarget.Library;
            folder1.Items.Add(projectLib1);

            DotNetProject projectLib2 = CreateProject(Util.Combine(dir, "nested-solution1", "library2"), "C#", "library2");

            projectLib2.References.Add(new ProjectReference(ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
            projectLib2.Files.Add(new ProjectFile(Path.Combine(projectLib2.BaseDirectory, "MyClass.cs")));
            projectLib2.Files.Add(new ProjectFile(Path.Combine(projectLib2.BaseDirectory, "Properties", "AssemblyInfo.cs")));
            projectLib2.CompileTarget = CompileTarget.Library;
            folder1.Items.Add(projectLib2);

            // nested-solution2

            SolutionFolder folder2 = new SolutionFolder();

            folder2.Name = "nested-solution2";
            sol.RootFolder.Items.Add(folder2);

            DotNetProject project2 = CreateProject(Util.Combine(dir, "nested-solution2", "console-project2"), "C#", "console-project2");

            project2.Files.Add(new ProjectFile(Path.Combine(project2.BaseDirectory, "Program.cs")));
            project2.Files.Add(new ProjectFile(Path.Combine(project2.BaseDirectory, "Properties", "AssemblyInfo.cs")));
            project2.References.Add(new ProjectReference(ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));

            // nested-solution3

            SolutionFolder folder3 = new SolutionFolder();

            folder3.Name = "nested-solution3";

            DotNetProject projectLib3 = CreateProject(Util.Combine(dir, "nested-solution2", "nested-solution3", "library3"), "C#", "library3");

            projectLib3.References.Add(new ProjectReference(ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
            projectLib3.Files.Add(new ProjectFile(Path.Combine(projectLib3.BaseDirectory, "MyClass.cs")));
            projectLib3.Files.Add(new ProjectFile(Path.Combine(projectLib3.BaseDirectory, "Properties", "AssemblyInfo.cs")));
            projectLib3.CompileTarget = CompileTarget.Library;
            folder3.Items.Add(projectLib3);

            DotNetProject projectLib4 = CreateProject(Util.Combine(dir, "nested-solution2", "nested-solution3", "library4"), "C#", "library4");

            projectLib4.References.Add(new ProjectReference(ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
            projectLib4.Files.Add(new ProjectFile(Path.Combine(projectLib4.BaseDirectory, "MyClass.cs")));
            projectLib4.Files.Add(new ProjectFile(Path.Combine(projectLib4.BaseDirectory, "Properties", "AssemblyInfo.cs")));
            projectLib4.CompileTarget = CompileTarget.Library;
            folder3.Items.Add(projectLib4);

            folder2.Items.Add(folder3);
            folder2.Items.Add(project2);

            string file = Path.Combine(dir, "TestSolution.sln");

            sol.FileName = file;

            project1.References.Add(new ProjectReference(ReferenceType.Package, "System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
            project1.References.Add(new ProjectReference(projectLib1));
            project1.References.Add(new ProjectReference(projectLib2));
            project1.References.Add(new ProjectReference(projectLib3));
            project1.References.Add(new ProjectReference(projectLib4));

            project2.References.Add(new ProjectReference(projectLib3));
            project2.References.Add(new ProjectReference(projectLib4));

            Assert.AreEqual(2, sol.Configurations.Count);
            Assert.AreEqual(6, scDebug.Configurations.Count);
            Assert.AreEqual(6, scRelease.Configurations.Count);

            return(sol);
        }
Пример #47
0
 public virtual IEnumerable <string> GetReferencedAssemblies(DotNetProject project, ConfigurationSelector configuration, bool includeProjectReferences)
 {
     return(GetNext(project).GetReferencedAssemblies(project, configuration, includeProjectReferences));
 }
Пример #48
0
 /// <summary>
 /// Currently this project extension is enabled for all SDK style projects and
 /// not just for .NET Core and .NET Standard projects. SDK project support
 /// should be separated out from this extension so it can be enabled only for
 /// .NET Core and .NET Standard projects.
 /// </summary>
 bool IsSdkProject(DotNetProject project)
 {
     return(project.MSBuildProject.GetReferencedSDKs().Length > 0);
 }
 public References(MD.DotNetProject project)
     : this(project, PackageManagementExtendedServices.ProjectService)
 {
 }