Skip to content
This repository was archived by the owner on Dec 18, 2017. It is now read-only.

Commit

Permalink
Peek into project refs to give more details to the IDE
Browse files Browse the repository at this point in the history
- Added WrappedProject to TargetFrameworkInformation
- Return the wrapped project file or assembly instead of a project reference
where appropriate.

#945
  • Loading branch information
davidfowl committed Dec 2, 2014
1 parent a569a4c commit 054ee91
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 8 deletions.
46 changes: 38 additions & 8 deletions src/Microsoft.Framework.DesignTimeHost/ApplicationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -887,16 +887,41 @@ private DependencyInfo ResolveProjectDepencies(Project project, string configura
if (string.Equals(library.Type, "Project") &&
!string.Equals(library.Identity.Name, project.Name))
{
info.ProjectReferences.Add(new ProjectReference
Project referencedProject;
if (!Project.TryGetProject(library.Path, out referencedProject))
{
Framework = new FrameworkData
// Should never happen
continue;
}

var targetFrameworkInformation = referencedProject.GetTargetFramework(library.Framework);

// If this is an assembly reference then treat it like a file reference
if (!string.IsNullOrEmpty(targetFrameworkInformation.AssemblyPath) &&
string.IsNullOrEmpty(targetFrameworkInformation.WrappedProject))
{
info.References.Add(GetProjectRelativeFullPath(referencedProject, targetFrameworkInformation.AssemblyPath));
}
else
{
string projectPath = library.Path;

if (!string.IsNullOrEmpty(targetFrameworkInformation.WrappedProject))
{
ShortName = VersionUtility.GetShortFrameworkName(library.Framework),
FrameworkName = library.Framework.ToString(),
FriendlyName = frameworkResolver.GetFriendlyFrameworkName(library.Framework)
},
Path = library.Path
});
projectPath = GetProjectRelativeFullPath(referencedProject, targetFrameworkInformation.WrappedProject);
}

info.ProjectReferences.Add(new ProjectReference
{
Framework = new FrameworkData
{
ShortName = VersionUtility.GetShortFrameworkName(library.Framework),
FrameworkName = library.Framework.ToString(),
FriendlyName = frameworkResolver.GetFriendlyFrameworkName(library.Framework)
},
Path = projectPath
});
}
}
}

Expand Down Expand Up @@ -931,6 +956,11 @@ private DependencyInfo ResolveProjectDepencies(Project project, string configura
});
}

private static string GetProjectRelativeFullPath(Project referencedProject, string path)
{
return Path.GetFullPath(Path.Combine(referencedProject.ProjectDirectory, path));
}

private static DependencyDescription CreateDependencyDescription(LibraryDescription library)
{
return new DependencyDescription
Expand Down
2 changes: 2 additions & 0 deletions src/Microsoft.Framework.Runtime/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,8 @@ private bool BuildTargetFrameworkNode(KeyValuePair<string, JToken> targetFramewo

targetFrameworkInformation.Dependencies.AddRange(frameworkAssemblies);

targetFrameworkInformation.WrappedProject = GetValue<string>(properties, "wrappedProject");

var binNode = properties["bin"];

if (binNode != null)
Expand Down
2 changes: 2 additions & 0 deletions src/Microsoft.Framework.Runtime/TargetFrameworkInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class TargetFrameworkInformation : IFrameworkTargetable

public IList<LibraryDependency> Dependencies { get; set; }

public string WrappedProject { get; set; }

public string AssemblyPath { get; set; }

public string PdbPath { get; set; }
Expand Down

0 comments on commit 054ee91

Please sign in to comment.