本文整理汇总了C#中Prebuild.Core.Nodes.ProjectNode类的典型用法代码示例。如果您正苦于以下问题:C# ProjectNode类的具体用法?C# ProjectNode怎么用?C# ProjectNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProjectNode类属于Prebuild.Core.Nodes命名空间,在下文中一共展示了ProjectNode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildReference
private static string BuildReference(SolutionNode solution, ProjectNode currentProject, ReferenceNode refr)
{
if (!String.IsNullOrEmpty(refr.Path))
{
return refr.Path;
}
if (solution.ProjectsTable.ContainsKey(refr.Name))
{
ProjectNode projectRef = (ProjectNode) solution.ProjectsTable[refr.Name];
string finalPath =
Helper.NormalizePath(refr.Name + GetProjectExtension(projectRef), '/');
return finalPath;
}
ProjectNode project = (ProjectNode) refr.Parent;
// Do we have an explicit file reference?
string fileRef = FindFileReference(refr.Name, project);
if (fileRef != null)
{
return fileRef;
}
// Is there an explicit path in the project ref?
if (refr.Path != null)
{
return Helper.NormalizePath(refr.Path + "/" + refr.Name + GetProjectExtension(project), '/');
}
// No, it's an extensionless GAC ref, but nant needs the .dll extension anyway
return refr.Name + ".dll";
}
示例2: GenerateXmlDocFile
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GenerateXmlDocFile(ProjectNode project, ConfigurationNode conf)
{
if( conf == null )
{
throw new ArgumentNullException("conf");
}
if( project == null )
{
throw new ArgumentNullException("project");
}
string docFile = (string)conf.Options["XmlDocFile"];
if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
{
return "False";
}
return "True";
}
示例3: GetXmlDocFile
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
{
if( conf == null )
{
throw new ArgumentNullException("conf");
}
if( project == null )
{
throw new ArgumentNullException("project");
}
string docFile = (string)conf.Options["XmlDocFile"];
// if(docFile != null && docFile.Length == 0)//default to assembly name if not specified
// {
// return Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
// }
return docFile;
}
示例4: NicePath
// This converts a path relative to the path of a project to
// a path relative to the solution path.
private string NicePath(ProjectNode proj, string path)
{
string res;
SolutionNode solution = (SolutionNode)proj.Parent;
res = Path.Combine(Helper.NormalizePath(proj.FullPath, '/'), Helper.NormalizePath(path, '/'));
res = Helper.NormalizePath(res, '/');
res = res.Replace("/./", "/");
while (res.IndexOf("/../") >= 0)
{
int a = res.IndexOf("/../");
int b = res.LastIndexOf("/", a - 1);
res = res.Remove(b, a - b + 3);
}
res = Helper.MakePathRelativeTo(solution.FullPath, res);
if (res.StartsWith("./"))
res = res.Substring(2, res.Length - 2);
res = Helper.NormalizePath(res, '/');
return res;
}
示例5: WriteProjectFiles
private void WriteProjectFiles(StreamWriter f, SolutionNode solution, ProjectNode project)
{
// Write list of source code files
f.WriteLine("SOURCES_{0} = \\", project.Name);
foreach (string file in project.Files)
if (project.Files.GetBuildAction(file) == BuildAction.Compile)
f.WriteLine("\t{0} \\", NicePath(project, file));
f.WriteLine();
// Write list of resource files
f.WriteLine("RESOURCES_{0} = \\", project.Name);
foreach (string file in project.Files)
if (project.Files.GetBuildAction(file) == BuildAction.EmbeddedResource)
{
string path = NicePath(project, file);
f.WriteLine("\t-resource:{0},{1} \\", path, Path.GetFileName(path));
}
f.WriteLine();
// There's also Content and None in BuildAction.
// What am I supposed to do with that?
}
示例6: WriteProject
private void WriteProject(SolutionNode solution, ProjectNode project)
{
if (!tools.ContainsKey(project.Language))
{
throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
}
ToolInfo toolInfo = tools[project.Language];
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
StreamWriter ps = new StreamWriter(projectFile);
kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
#region Project File
using (ps)
{
string targets = "";
if(project.Files.CopyFiles > 0)
targets = "Build;CopyFiles";
else
targets = "Build";
ps.WriteLine("<Project DefaultTargets=\"{0}\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" {1}>", targets, GetToolsVersionXml(project.FrameworkVersion));
ps.WriteLine(" <PropertyGroup>");
ps.WriteLine(" <ProjectType>Local</ProjectType>");
ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", ProductVersion);
ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", SchemaVersion);
ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
// Visual Studio has a hard coded guid for the project type
if (project.Type == ProjectType.Web)
ps.WriteLine(" <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>");
ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
ps.WriteLine(" <AssemblyKeyContainerName>");
ps.WriteLine(" </AssemblyKeyContainerName>");
ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
foreach (ConfigurationNode conf in project.Configurations)
{
if (conf.Options.KeyFile != "")
{
ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
ps.WriteLine(" <SignAssembly>true</SignAssembly>");
break;
}
}
ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
ps.WriteLine(" <DelaySign>false</DelaySign>");
ps.WriteLine(" <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", "."));
ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
if (string.IsNullOrEmpty(project.DebugStartParameters))
{
ps.WriteLine(" <StartArguments>{0}</StartArguments>", project.DebugStartParameters);
}
ps.WriteLine(" <FileUpgradeFlags>");
ps.WriteLine(" </FileUpgradeFlags>");
ps.WriteLine(" </PropertyGroup>");
foreach (ConfigurationNode conf in project.Configurations)
{
ps.Write(" <PropertyGroup ");
ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|{1}' \">", conf.Name, conf.Platform);
ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
ps.WriteLine(" <ConfigurationOverrideFile>");
ps.WriteLine(" </ConfigurationOverrideFile>");
ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
if (project.Type != ProjectType.Web)
ps.WriteLine(" <OutputPath>{0}</OutputPath>",
Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
else
ps.WriteLine(" <OutputPath>{0}</OutputPath>",
Helper.EndPath(Helper.NormalizePath("bin\\")));
ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
ps.WriteLine(" <PlatformTarget>{0}</PlatformTarget>", conf.Platform);
ps.WriteLine(" </PropertyGroup>");
}
//ps.WriteLine(" </Settings>");
//.........这里部分代码省略.........
示例7: GetXmlDocFile
/// <summary>
/// Gets the XML doc file.
/// </summary>
/// <param name="project">The project.</param>
/// <param name="conf">The conf.</param>
/// <returns></returns>
public static string GetXmlDocFile(ProjectNode project, ConfigurationNode conf)
{
if( conf == null )
{
throw new ArgumentNullException("conf");
}
if( project == null )
{
throw new ArgumentNullException("project");
}
// if(!(bool)conf.Options["GenerateXmlDocFile"]) //default to none, if the generate option is false
// {
// return string.Empty;
// }
//default to "AssemblyName.xml"
//string defaultValue = Path.GetFileNameWithoutExtension(project.AssemblyName) + ".xml";
//return (string)conf.Options["XmlDocFile", defaultValue];
//default to no XmlDocFile file
return (string)conf.Options["XmlDocFile", ""];
}
示例8: WriteProject
private void WriteProject(SolutionNode solution, ProjectNode project)
{
if (!tools.ContainsKey(project.Language))
{
throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
}
ToolInfo toolInfo = (ToolInfo)tools[project.Language];
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
StreamWriter ps = new StreamWriter(projectFile);
kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
#region Project File
using (ps)
{
ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"3.5\">");
ps.WriteLine(" <PropertyGroup>");
ps.WriteLine(" <ProjectType>Local</ProjectType>");
ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion);
ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion);
ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
// Visual Studio has a hard coded guid for the project type
if (project.Type == ProjectType.Web)
ps.WriteLine(" <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>");
ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
ps.WriteLine(" <AssemblyKeyContainerName>");
ps.WriteLine(" </AssemblyKeyContainerName>");
ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
foreach (ConfigurationNode conf in project.Configurations)
{
if (conf.Options.KeyFile != "")
{
ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
ps.WriteLine(" <SignAssembly>true</SignAssembly>");
break;
}
}
ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
ps.WriteLine(" <DelaySign>false</DelaySign>");
ps.WriteLine(" <TargetFrameworkVersion>{0}</TargetFrameworkVersion>", project.FrameworkVersion.ToString().Replace("_", "."));
ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type == ProjectType.Web ? ProjectType.Library.ToString() : project.Type.ToString());
ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
ps.WriteLine(" <FileUpgradeFlags>");
ps.WriteLine(" </FileUpgradeFlags>");
ps.WriteLine(" </PropertyGroup>");
foreach (ConfigurationNode conf in project.Configurations)
{
string compilerDefines = conf.Options["CompilerDefines"].ToString();
if (compilerDefines != String.Empty) compilerDefines += ";";
compilerDefines += "VISUAL_STUDIO";
ps.Write(" <PropertyGroup ");
ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name);
ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
ps.WriteLine(" <ConfigurationOverrideFile>");
ps.WriteLine(" </ConfigurationOverrideFile>");
ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", compilerDefines);
ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", Helper.NormalizePath(conf.Options["XmlDocFile"].ToString()));
ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
if (project.Type != ProjectType.Web)
ps.WriteLine(" <OutputPath>{0}</OutputPath>",
Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
else
ps.WriteLine(" <OutputPath>{0}</OutputPath>",
Helper.EndPath(Helper.NormalizePath("bin\\")));
ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
ps.WriteLine(" <NoStdLib>{0}</NoStdLib>", conf.Options["NoStdLib"]);
ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
ps.WriteLine(" </PropertyGroup>");
}
//ps.WriteLine(" </Settings>");
ArrayList projectReferences = new ArrayList(),
otherReferences = new ArrayList();
foreach (ReferenceNode refr in project.References)
{
ProjectNode projectNode = FindProjectInSolution(refr.Name, solution);
//.........这里部分代码省略.........
示例9: WriteProject
private void WriteProject(SolutionNode solution, ProjectNode project)
{
string projFile = Helper.MakeFilePath(project.FullPath, project.Name + GetProjectExtension(project), "build");
StreamWriter ss = new StreamWriter(projFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
bool hasDoc = false;
using (ss)
{
ss.WriteLine("<?xml version=\"1.0\" ?>");
ss.WriteLine("<project name=\"{0}\" default=\"build\">", project.Name);
ss.WriteLine(" <target name=\"{0}\">", "build");
ss.WriteLine(" <echo message=\"Build Directory is ${project::get-base-directory()}/${build.dir}\" />");
ss.WriteLine(" <mkdir dir=\"${project::get-base-directory()}/${build.dir}\" />");
ss.Write(" <csc ");
ss.Write(" target=\"{0}\"", project.Type.ToString().ToLower());
ss.Write(" debug=\"{0}\"", "${build.debug}");
ss.Write(" platform=\"${build.platform}\"");
foreach (ConfigurationNode conf in project.Configurations)
{
if (conf.Options.KeyFile != "")
{
ss.Write(" keyfile=\"{0}\"", conf.Options.KeyFile);
break;
}
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" unsafe=\"{0}\"", conf.Options.AllowUnsafe);
break;
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" warnaserror=\"{0}\"", conf.Options.WarningsAsErrors);
break;
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" define=\"{0}\"", conf.Options.CompilerDefines);
break;
}
foreach (ConfigurationNode conf in project.Configurations)
{
ss.Write(" nostdlib=\"{0}\"", conf.Options["NoStdLib"]);
break;
}
ss.Write(" main=\"{0}\"", project.StartupObject);
foreach (ConfigurationNode conf in project.Configurations)
{
if (GetXmlDocFile(project, conf) != "")
{
ss.Write(" doc=\"{0}\"", "${project::get-base-directory()}/${build.dir}/" + GetXmlDocFile(project, conf));
hasDoc = true;
}
break;
}
ss.Write(" output=\"{0}", "${project::get-base-directory()}/${build.dir}/${project::get-name()}");
if (project.Type == ProjectType.Library)
{
ss.Write(".dll\"");
}
else
{
ss.Write(".exe\"");
}
if (project.AppIcon != null && project.AppIcon.Length != 0)
{
ss.Write(" win32icon=\"{0}\"", Helper.NormalizePath(project.AppIcon, '/'));
}
// This disables a very different behavior between VS and NAnt. With Nant,
// If you have using System.Xml; it will ensure System.Xml.dll is referenced,
// but not in VS. This will force the behaviors to match, so when it works
// in nant, it will work in VS.
ss.Write(" noconfig=\"true\"");
ss.WriteLine(">");
ss.WriteLine(" <resources prefix=\"{0}\" dynamicprefix=\"true\" >", project.RootNamespace);
foreach (string file in project.Files)
{
switch (project.Files.GetBuildAction(file))
{
case BuildAction.EmbeddedResource:
ss.WriteLine(" {0}", "<include name=\"" + Helper.NormalizePath(PrependPath(file), '/') + "\" />");
break;
default:
if (project.Files.GetSubType(file) != SubType.Code && project.Files.GetSubType(file) != SubType.Settings)
{
ss.WriteLine(" <include name=\"{0}\" />", file.Substring(0, file.LastIndexOf('.')) + ".resx");
}
break;
}
}
//if (project.Files.GetSubType(file).ToString() != "Code")
//{
//.........这里部分代码省略.........
示例10: CleanProject
private void CleanProject(ProjectNode project)
{
kernel.Log.Write("...Cleaning project: {0}", project.Name);
ToolInfo toolInfo = (ToolInfo)tools[project.Language];
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
string userFile = projectFile + ".user";
Helper.DeleteIfExists(projectFile);
Helper.DeleteIfExists(userFile);
}
示例11: WriteProject
private void WriteProject(SolutionNode solution, ProjectNode project)
{
if (!tools.ContainsKey(project.Language))
{
throw new UnknownLanguageException("Unknown .NET language: " + project.Language);
}
ToolInfo toolInfo = (ToolInfo)tools[project.Language];
string projectFile = Helper.MakeFilePath(project.FullPath, project.Name, toolInfo.FileExtension);
StreamWriter ps = new StreamWriter(projectFile);
kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projectFile));
#region Project File
using (ps)
{
ps.WriteLine("<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">");
//ps.WriteLine(" <{0}", toolInfo.XMLTag);
ps.WriteLine(" <PropertyGroup>");
ps.WriteLine(" <ProjectType>Local</ProjectType>");
ps.WriteLine(" <ProductVersion>{0}</ProductVersion>", this.ProductVersion);
ps.WriteLine(" <SchemaVersion>{0}</SchemaVersion>", this.SchemaVersion);
ps.WriteLine(" <ProjectGuid>{{{0}}}</ProjectGuid>", project.Guid.ToString().ToUpper());
ps.WriteLine(" <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>");
ps.WriteLine(" <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>");
//ps.WriteLine(" <Build>");
//ps.WriteLine(" <Settings");
ps.WriteLine(" <ApplicationIcon>{0}</ApplicationIcon>", project.AppIcon);
ps.WriteLine(" <AssemblyKeyContainerName>");
ps.WriteLine(" </AssemblyKeyContainerName>");
ps.WriteLine(" <AssemblyName>{0}</AssemblyName>", project.AssemblyName);
foreach (ConfigurationNode conf in project.Configurations)
{
if (conf.Options.KeyFile != "")
{
ps.WriteLine(" <AssemblyOriginatorKeyFile>{0}</AssemblyOriginatorKeyFile>", conf.Options.KeyFile);
ps.WriteLine(" <SignAssembly>true</SignAssembly>");
break;
}
}
ps.WriteLine(" <DefaultClientScript>JScript</DefaultClientScript>");
ps.WriteLine(" <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>");
ps.WriteLine(" <DefaultTargetSchema>IE50</DefaultTargetSchema>");
ps.WriteLine(" <DelaySign>false</DelaySign>");
//if(m_Version == VSVersion.VS70)
// ps.WriteLine(" NoStandardLibraries = \"false\"");
ps.WriteLine(" <OutputType>{0}</OutputType>", project.Type.ToString());
ps.WriteLine(" <AppDesignerFolder>{0}</AppDesignerFolder>", project.DesignerFolder);
ps.WriteLine(" <RootNamespace>{0}</RootNamespace>", project.RootNamespace);
ps.WriteLine(" <StartupObject>{0}</StartupObject>", project.StartupObject);
//ps.WriteLine(" >");
ps.WriteLine(" <FileUpgradeFlags>");
ps.WriteLine(" </FileUpgradeFlags>");
ps.WriteLine(" </PropertyGroup>");
foreach (ConfigurationNode conf in project.Configurations)
{
ps.Write(" <PropertyGroup ");
ps.WriteLine("Condition=\" '$(Configuration)|$(Platform)' == '{0}|AnyCPU' \">", conf.Name);
ps.WriteLine(" <AllowUnsafeBlocks>{0}</AllowUnsafeBlocks>", conf.Options["AllowUnsafe"]);
ps.WriteLine(" <BaseAddress>{0}</BaseAddress>", conf.Options["BaseAddress"]);
ps.WriteLine(" <CheckForOverflowUnderflow>{0}</CheckForOverflowUnderflow>", conf.Options["CheckUnderflowOverflow"]);
ps.WriteLine(" <ConfigurationOverrideFile>");
ps.WriteLine(" </ConfigurationOverrideFile>");
ps.WriteLine(" <DefineConstants>{0}</DefineConstants>", conf.Options["CompilerDefines"]);
ps.WriteLine(" <DocumentationFile>{0}</DocumentationFile>", conf.Options["XmlDocFile"]);
ps.WriteLine(" <DebugSymbols>{0}</DebugSymbols>", conf.Options["DebugInformation"]);
ps.WriteLine(" <FileAlignment>{0}</FileAlignment>", conf.Options["FileAlignment"]);
// ps.WriteLine(" <IncrementalBuild = \"{0}\"", conf.Options["IncrementalBuild"]);
// if(m_Version == VSVersion.VS71)
// {
// ps.WriteLine(" NoStdLib = \"{0}\"", conf.Options["NoStdLib"]);
// ps.WriteLine(" NoWarn = \"{0}\"", conf.Options["SuppressWarnings"]);
// }
ps.WriteLine(" <Optimize>{0}</Optimize>", conf.Options["OptimizeCode"]);
ps.WriteLine(" <OutputPath>{0}</OutputPath>",
Helper.EndPath(Helper.NormalizePath(conf.Options["OutputPath"].ToString())));
ps.WriteLine(" <RegisterForComInterop>{0}</RegisterForComInterop>", conf.Options["RegisterComInterop"]);
ps.WriteLine(" <RemoveIntegerChecks>{0}</RemoveIntegerChecks>", conf.Options["RemoveIntegerChecks"]);
ps.WriteLine(" <TreatWarningsAsErrors>{0}</TreatWarningsAsErrors>", conf.Options["WarningsAsErrors"]);
ps.WriteLine(" <WarningLevel>{0}</WarningLevel>", conf.Options["WarningLevel"]);
ps.WriteLine(" <NoWarn>{0}</NoWarn>", conf.Options["SuppressWarnings"]);
ps.WriteLine(" </PropertyGroup>");
}
//ps.WriteLine(" </Settings>");
// Assembly References
ps.WriteLine(" <ItemGroup>");
string refPath = ((ReferencePathNode) project.ReferencePaths[0]).Path;
foreach (ReferenceNode refr in project.References)
//.........这里部分代码省略.........
示例12: WriteProject
private void WriteProject(StreamWriter f, SolutionNode solution, ProjectNode project)
{
f.WriteLine("# This is for project {0}", project.Name);
f.WriteLine();
WriteProjectFiles(f, solution, project);
WriteProjectReferences(f, solution, project);
WriteProjectDependencies(f, solution, project);
bool clash = ProjectClashes(project);
foreach (ConfigurationNode conf in project.Configurations)
{
string outpath = ProjectOutput(project, conf);
string filesToClean = outpath;
if (clash)
{
f.WriteLine("{0}-{1}: .{0}-{1}-timestamp", project.Name, conf.Name);
f.WriteLine();
f.Write(".{0}-{1}-timestamp: $(DEPENDENCIES_{0})", project.Name, conf.Name);
}
else
{
f.WriteLine("{0}-{1}: {2}", project.Name, conf.Name, outpath);
f.WriteLine();
f.Write("{2}: $(DEPENDENCIES_{0})", project.Name, conf.Name, outpath);
}
// Dependencies on other projects.
foreach (ReferenceNode refr in project.References)
if (solution.ProjectsTable.Contains(refr.Name))
{
ProjectNode refProj = (ProjectNode)solution.ProjectsTable[refr.Name];
if (ProjectClashes(refProj))
f.Write(" .{0}-{1}-timestamp", refProj.Name, conf.Name);
else
f.Write(" {0}", ProjectOutput(refProj, conf));
}
f.WriteLine();
// make directory for output.
if (Path.GetDirectoryName(outpath) != "")
{
f.WriteLine("\tmkdir -p {0}", Path.GetDirectoryName(outpath));
}
// mcs command line.
f.Write("\tgmcs", project.Name);
f.Write(" -warn:{0}", conf.Options["WarningLevel"]);
if ((bool)conf.Options["DebugInformation"])
f.Write(" -debug");
if ((bool)conf.Options["AllowUnsafe"])
f.Write(" -unsafe");
if ((bool)conf.Options["CheckUnderflowOverflow"])
f.Write(" -checked");
if (project.StartupObject != "")
f.Write(" -main:{0}", project.StartupObject);
if ((string)conf.Options["CompilerDefines"] != "")
{
f.Write(" -define:\"{0}\"", conf.Options["CompilerDefines"]);
}
f.Write(" -target:{0} -out:{1}", ProjectTypeToTarget(project.Type), outpath);
// Build references to other projects. Now that sux.
// We have to reference the other project in the same conf.
foreach (ReferenceNode refr in project.References)
if (solution.ProjectsTable.Contains(refr.Name))
{
ProjectNode refProj;
refProj = (ProjectNode)solution.ProjectsTable[refr.Name];
f.Write(" -r:{0}", ProjectOutput(refProj, conf));
}
f.Write(" $(REFERENCES_{0})", project.Name);
f.Write(" $(RESOURCES_{0})", project.Name);
f.Write(" $(SOURCES_{0})", project.Name);
f.WriteLine();
// Copy references with localcopy.
foreach (ReferenceNode refr in project.References)
if (refr.LocalCopy)
{
string outPath, srcPath, destPath;
outPath = Helper.NormalizePath((string)conf.Options["OutputPath"]);
if (solution.ProjectsTable.Contains(refr.Name))
{
ProjectNode refProj;
refProj = (ProjectNode)solution.ProjectsTable[refr.Name];
srcPath = ProjectOutput(refProj, conf);
destPath = Path.Combine(outPath, Path.GetFileName(srcPath));
destPath = NicePath(project, destPath);
if (srcPath != destPath)
{
f.WriteLine("\tcp -f {0} {1}", srcPath, destPath);
filesToClean += " " + destPath;
}
continue;
}
srcPath = FindFileReference(refr.Name, project);
if (srcPath != null)
//.........这里部分代码省略.........
示例13: WriteProject
private void WriteProject(SolutionNode solution, ProjectNode project)
{
string csComp = "Mcs";
string netRuntime = "Mono";
if(project.Runtime == ClrRuntime.Microsoft)
{
csComp = "Csc";
netRuntime = "MsNet";
}
string projFile = Helper.MakeFilePath(project.FullPath, project.Name, "mdp");
StreamWriter ss = new StreamWriter(projFile);
m_Kernel.CurrentWorkingDirectory.Push();
Helper.SetCurrentDir(Path.GetDirectoryName(projFile));
using(ss)
{
ss.WriteLine(
"<Project name=\"{0}\" description=\"\" standardNamespace=\"{1}\" newfilesearch=\"None\" enableviewstate=\"True\" fileversion=\"2.0\" language=\"C#\" clr-version=\"Net_2_0\" ctype=\"DotNetProject\">",
project.Name,
project.RootNamespace
);
int count = 0;
ss.WriteLine(" <Configurations active=\"{0}\">", solution.ActiveConfig);
foreach(ConfigurationNode conf in project.Configurations)
{
ss.WriteLine(" <Configuration name=\"{0}\" ctype=\"DotNetProjectConfiguration\">", conf.Name);
ss.Write(" <Output");
ss.Write(" directory=\"{0}\"", Helper.EndPath(Helper.NormalizePath(".\\" + conf.Options["OutputPath"].ToString())));
ss.Write(" assembly=\"{0}\"", project.AssemblyName);
ss.Write(" executeScript=\"{0}\"", conf.Options["RunScript"]);
//ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
//ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
if (conf.Options["PreBuildEvent"] != null && conf.Options["PreBuildEvent"].ToString().Length != 0)
{
ss.Write(" executeBeforeBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PreBuildEvent"].ToString()));
}
else
{
ss.Write(" executeBeforeBuild=\"{0}\"", conf.Options["PreBuildEvent"]);
}
if (conf.Options["PostBuildEvent"] != null && conf.Options["PostBuildEvent"].ToString().Length != 0)
{
ss.Write(" executeAfterBuild=\"{0}\"", Helper.NormalizePath(conf.Options["PostBuildEvent"].ToString()));
}
else
{
ss.Write(" executeAfterBuild=\"{0}\"", conf.Options["PostBuildEvent"]);
}
ss.Write(" executeBeforeBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.Write(" executeAfterBuildArguments=\"{0}\"", conf.Options["PreBuildEventArgs"]);
ss.WriteLine(" />");
ss.Write(" <Build");
ss.Write(" debugmode=\"True\"");
if (project.Type == ProjectType.WinExe)
{
ss.Write(" target=\"{0}\"", ProjectType.Exe.ToString());
}
else
{
ss.Write(" target=\"{0}\"", project.Type);
}
ss.WriteLine(" />");
ss.Write(" <Execution");
ss.Write(" runwithwarnings=\"{0}\"", !conf.Options.WarningsAsErrors);
ss.Write(" consolepause=\"True\"");
ss.Write(" runtime=\"{0}\"", netRuntime);
ss.Write(" clr-version=\"Net_2_0\"");
ss.WriteLine(" />");
ss.Write(" <CodeGeneration");
ss.Write(" compiler=\"{0}\"", csComp);
ss.Write(" warninglevel=\"{0}\"", conf.Options["WarningLevel"]);
ss.Write(" nowarn=\"{0}\"", conf.Options["SuppressWarnings"]);
ss.Write(" includedebuginformation=\"{0}\"", conf.Options["DebugInformation"]);
ss.Write(" optimize=\"{0}\"", conf.Options["OptimizeCode"]);
ss.Write(" unsafecodeallowed=\"{0}\"", conf.Options["AllowUnsafe"]);
ss.Write(" generateoverflowchecks=\"{0}\"", conf.Options["CheckUnderflowOverflow"]);
ss.Write(" mainclass=\"{0}\"", project.StartupObject);
ss.Write(" target=\"{0}\"", project.Type);
ss.Write(" definesymbols=\"{0}\"", conf.Options["CompilerDefines"]);
ss.Write(" generatexmldocumentation=\"{0}\"", GenerateXmlDocFile(project, conf));
ss.Write(" win32Icon=\"{0}\"", project.AppIcon);
ss.Write(" ctype=\"CSharpCompilerParameters\"");
ss.WriteLine(" />");
ss.WriteLine(" </Configuration>");
count++;
}
ss.WriteLine(" </Configurations>");
ss.Write(" <DeploymentInformation");
ss.Write(" target=\"\"");
ss.Write(" script=\"\"");
//.........这里部分代码省略.........
示例14: ProjectOutput
private string ProjectOutput(ProjectNode project, ConfigurationNode config)
{
string filepath;
filepath = Helper.MakeFilePath((string)config.Options["OutputPath"],
project.AssemblyName, ProjectTypeToExtension(project.Type));
return NicePath(project, filepath);
}
示例15: ProjectClashes
// Returns true if two configs in one project have the same output.
private bool ProjectClashes(ProjectNode project)
{
foreach (ConfigurationNode conf1 in project.Configurations)
foreach (ConfigurationNode conf2 in project.Configurations)
if (ProjectOutput(project, conf1) == ProjectOutput(project, conf2) && conf1 != conf2)
{
m_Kernel.Log.Write("Warning: Configurations {0} and {1} for project {2} output the same file",
conf1.Name, conf2.Name, project.Name);
m_Kernel.Log.Write("Warning: I'm going to use some timestamps(extra empty files).");
return true;
}
return false;
}