// attention il peut y avoir des doublons, used by GetInitEndMethods() and GetUsings() public IEnumerable <CompilerProjectReader> GetIncludeProjects(bool withoutExtensionProject = false) { if (_includeProjects == null) { _includeProjects = new List <CompilerProjectReader>(); //foreach (string includeProject in _projectXmlElement.GetValues("IncludeProject")) foreach (XElement xe in _projectXmlElement.GetElements("IncludeProject")) { if (withoutExtensionProject && xe.zAttribValue("extension").zTryParseAs(false)) { continue; } string includeProject = xe.zAttribValue("value"); CompilerProjectReader compilerProject = Create(new XmlConfig(GetPathFile(includeProject)).GetConfigElement("/AssemblyProject"), isIncludeProject: true); if (compilerProject != null) { _includeProjects.Add(compilerProject); _includeProjects.AddRange(compilerProject.GetIncludeProjects()); } else { Trace.WriteLine("IncludeProject not found \"{0}\" from project \"{1}\"", includeProject, _projectFile); } } } return(_includeProjects); }
// runCode : true when executing code from runsource, true for CompilerDefaultValues and ProjectDefaultValues, otherwise false // includeProject : true reading and include project, false reading the main project // set parameters for : // main project : Win32Resource // main project but not run code : Target, Platform, Output, Icon, KeyFile, CopySourceFiles, CopyRunSourceSourceFiles, CopyOutputDirectories // not run code : GenerateInMemory // always : DebugInformation, WarningLevel, CompilerOptions, PreprocessorSymbols, Sources, Files, SourceFiles, Assemblies // always but only once : Language, FrameworkVersion public void SetParameters(CompilerProjectReader project, bool runCode = false, bool includeProject = false) { if (project == null) return; //if (!includeProject) //{ SetLanguage(project.GetLanguage(), project); SetFrameworkVersion(project.GetFrameworkVersion(), project); //} if (!runCode && !includeProject) { //s = project.GetTarget(); //if (s != null) // AddCompilerOption("/target:" + s); SetTarget(project.GetTarget(), project); SetPlatform(project.GetPlatform(), project); } bool? b; if (!runCode) { b = project.GetGenerateInMemory(); if (b != null) _generateInMemory = (bool)b; } b = project.GetDebugInformation(); if (b != null) _debugInformation = (bool)b; int? i = project.GetWarningLevel(); if (i != null) _warningLevel = (int)i; AddCompilerOptions(project.GetCompilerOptions()); AddPreprocessorSymbols(project.GetPreprocessorSymbols()); string s; if (!runCode && !includeProject) { s = project.GetOutput(); if (s != null) SetOutputAssembly(s, project); } if (!includeProject) { SetWin32Resource(project.GetWin32Resource()); } //if (!includeProject) if (!includeProject && !includeProject) { s = project.GetIcon(); if (s != null) AddCompilerOption("/win32icon:\"" + s + "\""); } //if (!includeProject) if (!includeProject && !includeProject) { s = project.GetKeyFile(); if (s != null) AddCompilerOption("/keyfile:\"" + s + "\""); } if (!includeProject) { // GetIncludeProjects() get include project recursively foreach (CompilerProjectReader project2 in project.GetIncludeProjects()) { SetParameters(project2, runCode: runCode, includeProject: true); } } AddSources(project.GetSources()); AddFiles(project.GetFiles()); AddSourceFiles(project.GetSourceFiles()); AddAssemblies(project.GetAssemblies()); if (!runCode && !includeProject) { b = project.GetCopySourceFiles(); if (b != null) _copySourceFiles = (bool)b; b = project.GetCopyRunSourceSourceFiles(); if (b != null) _copyRunSourceSourceFiles = (bool)b; } if (!runCode && !includeProject) { AddCopyOutputDirectories(project.GetCopyOutputs()); } }