public void WriteStartSolution(Solution solution) { this.solution = solution; //writer.WriteStartDocument(); writer.WriteComment(" Generated by SLiNgshoT <http://injektilo.org/> "); if ( isReplaceRefs ) writer.WriteComment( string.Format( " with parameter replacerefs={0} ", parameters[ REPLACEREFS ] )); writer.WriteStartElement("project"); writer.WriteAttributeString("name", solution.SolutionName); writer.WriteAttributeString("default", "Debug"); WriteProperty("build.basedir", (string)parameters["build.basedir"]); // WriteProperty("reference.path", (string)parameters["reference.path"]); foreach (string configurationName in solution.GetConfigurationNames()) { writer.WriteStartElement("target"); writer.WriteAttributeString("name", Configuration.NantName( configurationName)); string depends = Configuration.NantName( configurationName ) + ".CopyRefs" ; foreach (Project project in solution.GetProjects()) { Configuration configuration = project.GetConfiguration(configurationName); if (configuration != null) { if (depends != null) { depends += ","; } depends += project.Name + "." + Configuration.NantName( configurationName ); } } writer.WriteAttributeString("depends", depends); writer.WriteEndElement(); // target } WriteSetupTarget(); WriteCopyRefsTargets( solution ); // 2003-04-18 jean rajotte }
public static void WriteSolution( SolutionWriter writer, TextWriter textWriter, string sln, Hashtable parameters, Hashtable uriMap) { writer.SetOutput(textWriter); writer.SetParameters(parameters); Solution solution = new Solution(); solution.Read(sln, uriMap); writer.WriteStartSolution(solution); foreach (Project project in solution.GetProjects()) { IList sourceFiles = project.GetSourceFiles(); if (sourceFiles.Count > 0) { writer.WriteStartProjectSourceFiles(project); foreach (File file in sourceFiles) { writer.WriteProjectSourceFile(file); } writer.WriteEndProjectSourceFiles(); } IList resXFiles = project.GetResXResourceFiles(); if (resXFiles.Count > 0) { writer.WriteStartProjectResXResourceFiles(project); foreach (File file in resXFiles) { writer.WriteProjectResXResourceFile(file); } writer.WriteEndProjectResXResourceFiles(); } IList resourceFiles = project.GetNonResXResourceFiles(); if (resourceFiles.Count > 0) { writer.WriteStartProjectNonResXResourceFiles(project); foreach (File file in resourceFiles) { writer.WriteProjectNonResXResourceFile(file); } writer.WriteEndProjectNonResXResourceFiles(); } } foreach (Project project in solution.GetProjects()) { if (project.CountFiles("Compile") > 0) { writer.WriteStartProject(project); writer.WriteStartProjectDependencies(); foreach (Project dependency in solution.GetDependencies(project)) { writer.WriteProjectDependency(dependency); } foreach (Reference reference in project.GetReferences()) { if (reference.Type == "Project") { writer.WriteProjectDependency(solution.GetProject(reference.Value)); } } foreach (File file in project.GetFiles()) { if (!file.RelativePath.EndsWith(".licx")) { writer.WriteProjectDependency(file); } } writer.WriteEndProjectDependencies(); IList resXFiles = project.GetResXResourceFiles(); if (resXFiles.Count > 0) { writer.WriteStartResXFiles(); foreach (File file in resXFiles) { writer.WriteResXFile(file); } writer.WriteEndResXFiles(); } writer.WriteStartAssembly(); IList sourceFiles = project.GetSourceFiles(); if (sourceFiles.Count > 0) { writer.WriteStartSourceFiles(); foreach (File file in sourceFiles) { writer.WriteSourceFile(file); } writer.WriteEndSourceFiles(); } writer.WriteStartReferences(); // Write out the standard system references. foreach (Reference reference in project.GetSystemReferences()) { if (reference != null) { // assume it's another project in sln and/or copy-local string path = reference.Value + ".dll"; bool inBuildPath = true; if ( !reference.CopyLocal && (reference.Type == "AssemblyName") ) { inBuildPath = false; if ( reference.SourcePath != string.Empty ) { path = reference.SourcePath; } if ( ! Path.IsPathRooted( path ) ) { path = Path.GetFullPath( solution.SolutionDirectory + "\\" + project.RelativePath + "\\" + path ); } } writer.WriteReference( path , inBuildPath ); } } // Write out the project references. foreach (Project referencedProject in project.GetReferencedProjects()) { writer.WriteReference(referencedProject); } writer.WriteEndReferences(); writer.WriteStartResources(); foreach (File file in project.GetResXResourceFiles()) { string path = project.RootNamespace + "." + Path.GetFileNameWithoutExtension(file.RelativePath) + ".resources"; writer.WriteResource(path, null, true); } foreach (File file in project.GetNonResXResourceFiles()) { writer.WriteResource( file.RelativePathFromSolutionDirectory, file.ResourceName, false); } writer.WriteEndResources(); writer.WriteEndAssembly(); // Write out the project references so that they can be copied. writer.WriteStartCopyProjectAssemblies(); foreach (Project referencedProject in project.GetReferencedProjects()) { writer.WriteCopyProjectAssembly(referencedProject); } writer.WriteEndCopyProjectAssemblies(); writer.WriteEndProject(); } } writer.WriteStartCleanTarget(); foreach (Project project in solution.GetProjects()) { writer.WriteCleanProject(project); } writer.WriteEndCleanTarget(); writer.WriteEndSolution(); }
internal EnterpriseProject(Solution solution, Guid id, string name) { _ParentProject = null; _Solution = solution; _ID = id; _Name = name; }
internal Project(Solution solution, Guid id, string name) { _Solution = solution; _ID = id; _Name = name; }
public void WriteStartSolution(Solution solution) { writer.WriteLine("# Generated by SLiNgshoT <http://injektilo.org/>"); writer.WriteLine(); writer.WriteLine("!IFNDEF CFG"); writer.WriteLine(); writer.WriteLine("CFG = Debug"); writer.WriteLine(); writer.WriteLine("!ENDIF"); writer.WriteLine(); bool firstConfig = true; foreach (string configurationName in solution.GetConfigurationNames()) { if (firstConfig) { writer.Write("!IF"); firstConfig = false; } else { writer.Write("!ELSE IF"); } writer.WriteLine(" \"$(CFG)\" == \"{0}\"", configurationName); writer.WriteLine(); foreach (Project project in solution.GetProjects()) { Configuration configuration = project.GetConfiguration(configurationName); writer.WriteLine( GetProjectName(project) + "_DIRECTORY = " + Path.GetDirectoryName(project.GetRelativeOutputPathForConfiguration(configurationName))); writer.WriteLine( GetProjectName(project) + " = $(" + GetProjectName(project) + "_DIRECTORY)\\" + Path.GetFileName(project.GetRelativeOutputPathForConfiguration(configurationName))); writer.WriteLine( GetProjectName(project) + "_DEBUG = /debug" + (configuration.DebugSymbols ? "+" : "-")); writer.WriteLine( GetProjectName(project) + "_UNSAFE = /unsafe" + (configuration.AllowUnsafeBlocks ? "+" : "-")); writer.Write(GetProjectName(project) + "_DEFINES ="); string defineConstants = configuration.DefineConstants; if (defineConstants != null && defineConstants.Length > 0) { writer.Write(" /define:" + defineConstants); } writer.WriteLine(); string documentationFile = Path.GetFileName(project.GetRelativePathToDocumentationFile(configurationName)); if (documentationFile != null && documentationFile.Length > 0) { writer.WriteLine( GetProjectName(project) + "_DOC = /doc:$(" + GetProjectName(project) + "_DIRECTORY)\\" + documentationFile); } else { writer.WriteLine("{0}_DOC =", GetProjectName(project)); } writer.WriteLine(); } } writer.WriteLine("!ENDIF"); writer.WriteLine(); writer.Write("all:"); foreach (Project project in solution.GetProjects()) { if (project.CountFiles("Compile") > 0) { writer.Write(" $(" + GetProjectName(project) + ")"); } } writer.WriteLine(); writer.WriteLine(); }
/// <summary> /// Create the targets that copy 'local copy' references to the build dir /// </summary> /// <param name="solution">the solution being analyzed</param> private void WriteCopyRefsTargets( Solution solution ) { // copy the 'copy local' references to the build directory ArrayList referenceNames = new ArrayList(); // get a unique list foreach (Project project in solution.GetProjects()) { if (project.CountFiles("Compile") > 0) { foreach (Reference reference in project.GetReferences()) { if ( !referenceNames.Contains( reference.Value ) ) { referenceNames.Add( reference.Value ); } } } } // create the copy targets foreach (string configurationName in solution.GetConfigurationNames()) { writer.WriteStartElement("target"); writer.WriteAttributeString("name", string.Concat( Configuration.NantName( configurationName), ".CopyRefs") ); WriteProperty("build.dir", "${build.basedir}\\" + Configuration.NantName( configurationName )); foreach ( string referenceName in referenceNames ) { writeCopyRef( referenceName, configurationName ); } writer.WriteEndElement(); // target } }
internal Reference(Solution solution, XPathNavigator navigator) { _Solution = solution; _Navigator = navigator.Clone(); }