diff --git a/src/dotnet/commands/dotnet-projectmodel-server/Models/DependencyDescription.cs b/src/dotnet/commands/dotnet-projectmodel-server/Models/DependencyDescription.cs index 07aa58a64..32c3854e5 100644 --- a/src/dotnet/commands/dotnet-projectmodel-server/Models/DependencyDescription.cs +++ b/src/dotnet/commands/dotnet-projectmodel-server/Models/DependencyDescription.cs @@ -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 { @@ -23,7 +24,7 @@ namespace Microsoft.DotNet.ProjectModel.Server.Models public string Type { get; private set; } public bool Resolved { get; private set; } - + public IEnumerable Dependencies { get; private set; } public IEnumerable Errors { get; private set; } @@ -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, diff --git a/test/dotnet-projectmodel-server.Tests/DthTests.cs b/test/dotnet-projectmodel-server.Tests/DthTests.cs index 56969c2e9..4a36cd9f0 100644 --- a/test/dotnet-projectmodel-server.Tests/DthTests.cs +++ b/test/dotnet-projectmodel-server.Tests/DthTests.cs @@ -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( "Version", v => !string.IsNullOrEmpty(v.ToString()), - v => "Version string shouldn't be empty."); + v => $"Version string shouldn't be empty. Value [{v.ToString()}]"); } }