本文整理汇总了C#中Solution.GetAllProjects方法的典型用法代码示例。如果您正苦于以下问题:C# Solution.GetAllProjects方法的具体用法?C# Solution.GetAllProjects怎么用?C# Solution.GetAllProjects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Solution
的用法示例。
在下文中一共展示了Solution.GetAllProjects方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateInstallPackageActions
List<InstallPackageAction> CreateInstallPackageActions (Solution solution, IList<PackageReferencesForCreatedProject> packageReferencesForCreatedProjects)
{
var installPackageActions = new List<InstallPackageAction> ();
foreach (PackageReferencesForCreatedProject packageReferences in packageReferencesForCreatedProjects) {
var project = solution.GetAllProjects ().First (p => p.Name == packageReferences.ProjectName) as DotNetProject;
if (project != null) {
installPackageActions.AddRange (CreateInstallPackageActions (project, packageReferences));
}
}
return installPackageActions;
}
示例2: CreateInstallPackageActions
internal List<IPackageAction> CreateInstallPackageActions (Solution solution, IList<PackageReferencesForCreatedProject> packageReferencesForCreatedProjects)
{
var repositoryProvider = new ProjectTemplateSourceRepositoryProvider ();
var installPackageActions = new List<IPackageAction> ();
foreach (PackageReferencesForCreatedProject packageReferences in packageReferencesForCreatedProjects) {
var project = solution.GetAllProjects ().FirstOrDefault (p => p.Name == packageReferences.ProjectName) as DotNetProject;
if (project != null) {
installPackageActions.AddRange (CreateInstallPackageActions (project, packageReferences, repositoryProvider));
}
}
return installPackageActions;
}
示例3: GetFileNames
public IEnumerable<Tuple<ProjectDom, FilePath>> GetFileNames(Solution solution, ProjectDom dom, ICompilationUnit unit, IProgressMonitor monitor)
{
int counter = 0;
ReadOnlyCollection<Project> allProjects = solution.GetAllProjects();
if (monitor != null)
monitor.BeginTask(GettextCatalog.GetString("Finding references in solution..."),
allProjects.Sum<Project>(p => p.Files.Count));
foreach (Project project in allProjects) {
if (monitor != null && monitor.IsCancelRequested) yield break;
ProjectDom currentDom = ProjectDomService.GetProjectDom(project);
foreach (ProjectFile projectFile in (Collection<ProjectFile>) project.Files) {
if (monitor != null && monitor.IsCancelRequested) yield break;
yield return Tuple.Create<ProjectDom, FilePath>(currentDom, projectFile.FilePath);
if (monitor != null) {
if (counter % 10 == 0) monitor.Step(10);
++counter;
}
}
}
if (monitor != null) monitor.EndTask();
}
示例4: AssertOutputFiles
static void AssertOutputFiles (Solution solution, string projectName, string configuration, string[] expectedFiles)
{
foreach (Project proj in solution.GetAllProjects ()) {
if (proj.Name == projectName) {
AssertOutputFiles (proj, configuration, expectedFiles);
return;
}
}
Assert.Fail ("Did not find project '{0}'", projectName);
}
示例5: LoadSolutionContents
void LoadSolutionContents (Solution sln)
{
loadedSlns.Add (sln);
System.Threading.ThreadPool.QueueUserWorkItem (delegate {
// Load all tags that are stored in pidb files
foreach (Project p in sln.GetAllProjects ()) {
var pContext = TypeSystemService.GetProjectContentWrapper (p);
if (pContext == null) {
continue;
}
var tags = pContext.GetExtensionObject<ProjectCommentTags> ();
if (tags == null) {
tags = new ProjectCommentTags ();
pContext.UpdateExtensionObject (tags);
tags.Update (pContext.Project);
} else {
foreach (var kv in tags.Tags) {
UpdateCommentTags (sln, kv.Key, kv.Value);
}
}
}
});
}
示例6: GetAllReferencingProjects
public static List<Project> GetAllReferencingProjects (Solution solution, Project sourceProject)
{
var projects = new List<Project> ();
projects.Add (sourceProject);
foreach (var project in solution.GetAllProjects ()) {
if (project.GetReferencedItems (ConfigurationSelector.Default).Any (prj => prj == sourceProject))
projects.Add (project);
}
return projects;
}
示例7: LoadSolutionContents
void LoadSolutionContents (Solution sln)
{
src.Cancel ();
src = new CancellationTokenSource ();
var token = src.Token;
loadedSlns.Add (sln);
Task.Run (delegate {
sln.SolutionItemAdded += delegate(object sender, SolutionItemChangeEventArgs e) {
var newProject = e.SolutionItem as Project;
if (newProject == null)
return;
UpdateCommentTagsForProject (sln, newProject, token);
};
// Load all tags that are stored in pidb files
foreach (Project p in sln.GetAllProjects ()) {
UpdateCommentTagsForProject (sln, p, token);
}
});
}
示例8: GetFileNames
static IEnumerable<Tuple<ProjectDom, FilePath>> GetFileNames (Solution solution, ProjectDom dom, ICompilationUnit unit, INode member, IProgressMonitor monitor)
{
var scope = GetScope (member);
switch (scope) {
case RefactoryScope.File:
case RefactoryScope.DeclaringType:
if (dom != null && unit != null)
yield return Tuple.Create (dom, unit.FileName);
break;
case RefactoryScope.Project:
if (dom == null)
yield break;
if (monitor != null)
monitor.BeginTask (GettextCatalog.GetString ("Search reference in project..."), dom.Project.Files.Count);
int counter = 0;
foreach (var file in dom.Project.Files) {
if (monitor != null && monitor.IsCancelRequested)
yield break;
yield return Tuple.Create (dom, file.FilePath);
if (monitor != null) {
if (counter % 10 == 0)
monitor.Step (10);
counter++;
}
}
if (monitor != null)
monitor.EndTask ();
break;
case RefactoryScope.Solution:
if (monitor != null)
monitor.BeginTask (GettextCatalog.GetString ("Search reference in solution..."), solution.GetAllProjects ().Count);
foreach (var project in solution.GetAllProjects ()) {
if (monitor != null && monitor.IsCancelRequested)
yield break;
var currentDom = ProjectDomService.GetProjectDom (project);
foreach (var file in project.Files) {
if (monitor != null && monitor.IsCancelRequested)
yield break;
yield return Tuple.Create (currentDom, file.FilePath);
}
if (monitor != null)
monitor.Step (1);
}
if (monitor != null)
monitor.EndTask ();
break;
}
}
示例9: LoadSolutionContents
void LoadSolutionContents (Solution sln)
{
loadedSlns.Add (sln);
// Load all tags that are stored in pidb files
foreach (Project p in sln.GetAllProjects ()) {
var pContext = TypeSystemService.GetProjectContext (p);
if (pContext == null)
continue;
foreach (ProjectFile file in p.Files) {
UpdateCommentTags (sln, file.Name, GetSpecialComments (pContext, file.Name));
}
}
}
示例10: BuildVersions
/// <summary>
/// Builds the versions from the projects
/// </summary>
/// <param name="MainSolution">The main solution.</param>
/// <returns></returns>
/// <exception cref="System.Exception"></exception>
public static SolutionVersion BuildVersions (Solution MainSolution)
{
var solVersion = new SolutionVersion () {
Version = new Version (MainSolution.Version),
};
try
{
foreach (Project proj in MainSolution.GetAllProjects())
{
String directory = String.Empty;
if (!String.IsNullOrEmpty (proj.FileName))
{
try
{
directory = Path.GetDirectoryName (proj.FileName);
}
catch (Exception ex)
{
throw new Exception (String.Format ("Path {0} is invalid", proj.FileName), ex);
}
var newVersion = new ProjectVersion () {
ProjType = ProjectType.DotNet,
SourceProject = proj,
Version = new Version (proj.Version),
};
var paths = new List<String> ();
//c# sub folder
paths.Add (Path.Combine (Path.Combine (directory, @"Properties"), "AssemblyInfo.cs"));
paths.Add (Path.Combine (directory, "AssemblyInfo.cs"));
paths.Add (Path.Combine (Path.Combine (directory, @"My Project"), "AssemblyInfo.vb"));
paths.Add (Path.Combine (directory, "AssemblyInfo.vb"));
foreach (var aPath in paths)
{
//c or vb.net
if (File.Exists (aPath))
{
newVersion.AssemblyVersionInfo = new AssemblyVersionInfo (aPath);
continue;
}
}
var iOSTypes = new List<String>{ "{FEACFBD2-3405-455C-9665-78FE426C6842}","{EE2C853D-36AF-4FDB-B1AD-8E90477E2198}"};
var androidTypes = new List<String> { "{EFBA0AD7-5A72-4C68-AF49-83D382785DCF}","{10368E6C-D01B-4462-8E8B-01FC667A7035}"};
var macTypes = new List<String> { "{A3F8F2AB-B479-4A4A-A458-A89E7DC349F1}", "{EE2C853D-36AF-4FDB-B1AD-8E90477E2198}" };
if (iOSTypes.Contains(proj.FlavorGuids.First()))
{
var iVersion = new iOSAppVersion();
var infoPlist = proj.Files.FirstOrDefault(x => x.Name.ToLower().Contains("info.plist"));
if (infoPlist != null)
{
iVersion.FilePath = infoPlist.FilePath;
// only set if the info.plist exists
newVersion.AppVerisonInfo = iVersion;
newVersion.ProjType = ProjectType.iOS;
}
}
else if (androidTypes.Contains(proj.FlavorGuids.First()))
{
var aVersion = new AndroidAppVersion();
var manifest = proj.Files.FirstOrDefault(x => x.Name.ToLower().Contains("androidmanifest.xml"));
if (manifest != null)
{
aVersion.FilePath = manifest.FilePath;
//only set for the apps with a manifest
newVersion.ProjType = ProjectType.Android;
newVersion.AppVerisonInfo = aVersion;
}
}
else if (macTypes.Contains(proj.FlavorGuids.First()))
{
var apVersion = new MacAppVersion();
var infoPlist = proj.Files.FirstOrDefault(x => x.Name.ToLower().Contains("info.plist"));
if (infoPlist != null)
//.........这里部分代码省略.........
示例11: LoadSolutionContents
void LoadSolutionContents(Solution sln)
{
loadedSlns.Add (sln);
System.Threading.ThreadPool.QueueUserWorkItem (delegate {
sln.SolutionItemAdded += delegate(object sender, SolutionItemChangeEventArgs e) {
var newProject = e.SolutionItem as Project;
if (newProject == null)
return;
UpdateCommentTagsForProject (sln, newProject);
};
// Load all tags that are stored in pidb files
foreach (Project p in sln.GetAllProjects ()) {
UpdateCommentTagsForProject (sln, p);
}
});
}
示例12: FindReferences
public static IEnumerable<MemberReference> FindReferences (Solution solution, INode member)
{
var scope = GetScope (member);
ReferenceFinder finder;
ProjectDom dom = null;
ICompilationUnit unit = null;
IEnumerable<INode> searchNodes = new INode[] { member };
if (member is LocalVariable) {
dom = ((LocalVariable)member).DeclaringMember.DeclaringType.SourceProjectDom;
unit = ((LocalVariable)member).CompilationUnit;
} else if (member is IParameter) {
dom = ((IParameter)member).DeclaringMember.DeclaringType.SourceProjectDom;
unit = ((IParameter)member).DeclaringMember.DeclaringType.CompilationUnit;
} else if (member is IType) {
dom = ((IType)member).SourceProjectDom;
unit = ((IType)member).CompilationUnit;
} else if (member is IMember) {
dom = ((IMember)member).DeclaringType.SourceProjectDom;
unit = ((IMember)member).DeclaringType.CompilationUnit;
searchNodes = CollectMembers (dom, (IMember)member);
}
switch (scope) {
case RefactoryScope.File:
case RefactoryScope.DeclaringType:
if (dom == null || unit == null)
yield break;
finder = GetReferenceFinder (DesktopService.GetMimeTypeForUri (unit.FileName));
if (finder == null)
yield break;
foreach (var searchNode in searchNodes) {
foreach (var foundReference in finder.FindReferences (dom, unit.FileName, searchNode)) {
yield return foundReference;
}
}
break;
case RefactoryScope.Project:
if (dom == null)
yield break;
foreach (var file in dom.Project.Files) {
finder = GetReferenceFinder (DesktopService.GetMimeTypeForUri (file.FilePath));
if (finder == null)
continue;
foreach (var searchNode in searchNodes) {
foreach (var foundReference in finder.FindReferences (dom, file.FilePath, searchNode)) {
yield return foundReference;
}
}
}
break;
case RefactoryScope.Solution:
foreach (var project in solution.GetAllProjects ()) {
var currentDom = ProjectDomService.GetProjectDom (project);
foreach (var file in project.Files) {
finder = GetReferenceFinder (DesktopService.GetMimeTypeForUri (file.FilePath));
if (finder == null)
continue;
foreach (var searchNode in searchNodes) {
foreach (var foundReference in finder.FindReferences (currentDom, file.FilePath, searchNode)) {
yield return foundReference;
}
}
}
}
break;
}
}
示例13: FindReferences
public static IEnumerable<MemberReference> FindReferences (Solution solution, INode member, ISearchProgressMonitor monitor = null)
{
var scope = GetScope (member);
ReferenceFinder finder;
ProjectDom dom = null;
ICompilationUnit unit = null;
IEnumerable<INode> searchNodes = new INode[] { member };
if (member is LocalVariable) {
dom = ((LocalVariable)member).DeclaringMember.DeclaringType.SourceProjectDom;
unit = ((LocalVariable)member).CompilationUnit;
} else if (member is IParameter) {
dom = ((IParameter)member).DeclaringMember.DeclaringType.SourceProjectDom;
unit = ((IParameter)member).DeclaringMember.DeclaringType.CompilationUnit;
} else if (member is IType) {
dom = ((IType)member).SourceProjectDom;
unit = ((IType)member).CompilationUnit;
} else if (member is IMember) {
dom = ((IMember)member).DeclaringType.SourceProjectDom;
unit = ((IMember)member).DeclaringType.CompilationUnit;
searchNodes = CollectMembers (dom, (IMember)member);
}
switch (scope) {
case RefactoryScope.File:
case RefactoryScope.DeclaringType:
if (dom == null || unit == null)
yield break;
finder = GetReferenceFinder (DesktopService.GetMimeTypeForUri (unit.FileName));
if (finder == null)
yield break;
foreach (var searchNode in searchNodes) {
foreach (var foundReference in finder.FindReferences (dom, unit.FileName, searchNode)) {
yield return foundReference;
}
}
break;
case RefactoryScope.Project:
if (dom == null)
yield break;
if (monitor != null)
monitor.BeginTask (GettextCatalog.GetString ("Search reference in project..."), dom.Project.Files.Count);
int counter = 0;
foreach (var file in dom.Project.Files) {
finder = GetReferenceFinder (DesktopService.GetMimeTypeForUri (file.FilePath));
if (finder == null)
continue;
foreach (var searchNode in searchNodes) {
foreach (var foundReference in finder.FindReferences (dom, file.FilePath, searchNode)) {
yield return foundReference;
}
}
if (monitor != null) {
if (counter % 10 == 0)
monitor.Step (10);
counter++;
}
}
if (monitor != null)
monitor.EndTask ();
break;
case RefactoryScope.Solution:
if (monitor != null)
monitor.BeginTask (GettextCatalog.GetString ("Search reference in solution..."), solution.GetAllProjects ().Count);
foreach (var project in solution.GetAllProjects ()) {
var currentDom = ProjectDomService.GetProjectDom (project);
foreach (var file in project.Files) {
finder = GetReferenceFinder (DesktopService.GetMimeTypeForUri (file.FilePath));
if (finder == null)
continue;
foreach (var searchNode in searchNodes) {
foreach (var foundReference in finder.FindReferences (currentDom, file.FilePath, searchNode)) {
yield return foundReference;
}
}
}
if (monitor != null)
monitor.Step (1);
}
if (monitor != null)
monitor.EndTask ();
break;
}
}
示例14: GetAllFiles
// OnInit
/// <summary>
/// Returns a list of all files relevant to the solution
/// </summary>
private static List<FilePath> GetAllFiles(Solution s)
{
List<FilePath> files = new List<FilePath>();
files.Add(s.FileName);
foreach (Solution child in s.GetAllSolutions ())
{
if (s != child)
files.AddRange(GetAllFiles(child));
}// recurse!
foreach (Project project in s.GetAllProjects ())
{
files.Add(project.FileName);
foreach (ProjectFile pfile in project.Files)
{
files.Add(pfile.FilePath);
}// add project file
}// add project files
return files;
}
示例15: GetAllReferencingProjects
static IEnumerable<Project> GetAllReferencingProjects (Solution solution, string assemblyName)
{
return solution.GetAllProjects ().Where (
project => TypeSystemService.GetCompilation (project).Assemblies.Any (a => a.AssemblyName == assemblyName));
}