Skip to content

Commit

Permalink
Merge pull request #184 from anisoptera/crash-on-missing-name-in-refe…
Browse files Browse the repository at this point in the history
…rence

Fix crash on missing Name attribute in a ProjectReference
  • Loading branch information
nosami committed Aug 12, 2015
2 parents de1d509 + 660768d commit 2ae4019
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion OmniSharp/Solution/CSharpProject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ void AddProjectReferences(Microsoft.Build.Evaluation.Project p)
{
foreach (Microsoft.Build.Evaluation.ProjectItem item in p.GetItems("ProjectReference"))
{
var projectName = item.GetMetadataValue("Name");
var projectName = item.HasMetadata("Name")
? item.GetMetadataValue("Name")
: Path.GetFileNameWithoutExtension(item.EvaluatedInclude);

var referenceGuid = Guid.Parse(item.GetMetadataValue("Project"));
_logger.Debug("Adding project reference {0}, {1}", projectName, referenceGuid);
AddReference(new ProjectReference(_solution, projectName, referenceGuid));
Expand Down

0 comments on commit 2ae4019

Please sign in to comment.