Use default version for unresolved MSBuild reference

This commit is contained in:
Troy Dai 2016-04-03 22:03:06 -07:00
parent c6eb0fa59a
commit e63c0f82c9
2 changed files with 5 additions and 3 deletions

View file

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using Microsoft.DotNet.ProjectModel.Compilation;
using Microsoft.DotNet.ProjectModel.Graph;
using NuGet.Versioning;
namespace Microsoft.DotNet.ProjectModel.Server.Models
{
@ -60,7 +61,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models
{
Name = library.Identity.Name,
DisplayName = library.Identity.Name,
Version = library.Identity.Version?.ToNormalizedString(),
Version = (library.Identity.Version ?? new NuGetVersion("1.0.0")).ToNormalizedString(),
Type = library.Identity.Type.Value,
Resolved = library.Resolved,
Path = library.Path,

View file

@ -438,12 +438,13 @@ namespace Microsoft.DotNet.ProjectModel.Server.Tests
client.Initialize(projectPath);
var messages = client.DrainAllMessages();
messages.AssertDoesNotContain(MessageTypes.Error);
// PrintAllMessages(new[] { messages.RetrieveSingleMessage(MessageTypes.Dependencies) });
messages.RetrieveSingleMessage(MessageTypes.Dependencies)
.RetrieveDependency("ClassLibrary4")
.AssertProperty<object>(
"Version",
v => !string.IsNullOrEmpty(v.ToString()),
v => "Version string shouldn't be empty.");
v => $"Version string shouldn't be empty. Value [{v.ToString()}]");
}
}