本文整理汇总了C#中Project.GetReference方法的典型用法代码示例。如果您正苦于以下问题:C# Project.GetReference方法的具体用法?C# Project.GetReference怎么用?C# Project.GetReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Project
的用法示例。
在下文中一共展示了Project.GetReference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ClearBuildFlags
private void ClearBuildFlags(Project project)
{
foreach (var reference in project.References)
{
var loadedReference = project.GetReference(reference);
ClearBuildFlags(loadedReference);
}
project.IsBuilding = false;
}
示例2: GetFileCount
private int GetFileCount (Project project)
{
int result = 0;
foreach (var reference in project.References)
{
var loadedReference = project.GetReference(reference);
result += GetFileCount(loadedReference);
}
if(!project.IsBuilding)
{
project.IsBuilding = true;
result += project.SourceFiles.Count;
}
return result;
}
示例3: CleanAll
private async Task CleanAll(IConsole console, Project superProject, Project project)
{
foreach (var reference in project.References)
{
var loadedReference = project.GetReference(reference);
if (loadedReference.Type == ProjectType.Executable)
{
await CleanAll(console, loadedReference, loadedReference);
}
else
{
await CleanAll(console, superProject, loadedReference);
}
}
string outputDirectory = project.GetObjectDirectory(superProject);
bool hasCleaned = false;
if (Directory.Exists(outputDirectory))
{
hasCleaned = true;
try
{
Directory.Delete(outputDirectory, true);
}
catch (Exception)
{
}
}
outputDirectory = project.GetOutputDirectory(superProject);
if (Directory.Exists(outputDirectory))
{
hasCleaned = true;
try
{
Directory.Delete(outputDirectory, true);
}
catch (Exception)
{
}
}
if (hasCleaned)
{
console.WriteLine(string.Format("[BB] - Cleaning Project - {0}", project.Name));
}
}
示例4: CompileProject
private async Task CompileProject(IConsole console, Project superProject, Project project, List<CompileResult> results = null)
{
if (project.Type == ProjectType.Executable && superProject != project)
{
await Build(console, project);
}
else
{
if (!terminateBuild)
{
if (results == null)
{
results = new List<CompileResult>();
}
foreach (var reference in project.References)
{
var loadedReference = project.GetReference(reference);
await CompileProject(console, superProject, loadedReference, results);
}
var outputDirectory = project.GetOutputDirectory(superProject);
if (!Directory.Exists(outputDirectory))
{
Directory.CreateDirectory(outputDirectory);
}
bool doWork = false;
lock (resultLock)
{
if (!project.IsBuilding)
{
project.IsBuilding = true;
doWork = true;
}
}
if (doWork)
{
var objDirectory = project.GetObjectDirectory(superProject);
if (!Directory.Exists(objDirectory))
{
Directory.CreateDirectory(objDirectory);
}
var compileResults = new CompileResult();
compileResults.Project = project;
results.Add(compileResults);
var tasks = new List<Task>();
//var parallelResult = Parallel.ForEach(project.SourceFiles, (file) =>
int numLocalTasks = 0;
foreach (var file in project.SourceFiles)
{
if (terminateBuild)
{
break;
}
if (Path.GetExtension(file.Location) == ".c" || Path.GetExtension(file.Location) == ".cpp")
{
var outputName = Path.GetFileNameWithoutExtension(file.Location) + ".o";
var dependencyFile = Path.Combine(objDirectory, Path.GetFileNameWithoutExtension(file.Location) + ".d");
var objectFile = Path.Combine(objDirectory, outputName);
bool dependencyChanged = false;
if (File.Exists(dependencyFile))
{
List<string> dependencies = new List<string>();
//lock(resultLock)
{
dependencies.AddRange(ProjectExtensions.GetDependencies(dependencyFile));
foreach (var dependency in dependencies)
{
if (!File.Exists(dependency) || File.GetLastWriteTime(dependency) > File.GetLastWriteTime(objectFile))
{
dependencyChanged = true;
break;
}
}
}
}
if (dependencyChanged || !File.Exists(objectFile))
{
while (numTasks >= Jobs)
{
Thread.Yield();
}
lock (resultLock)
//.........这里部分代码省略.........