Merge pull request #3150 from ErikSchierboom/diagnostic-missing-dotnet-restore

Add 'dotnet restore' instruction when lock file is missing (#3051)
This commit is contained in:
Eric Erhardt 2016-05-20 11:22:22 -05:00
commit d71e80bc7f
2 changed files with 2 additions and 1 deletions

View file

@ -104,7 +104,7 @@ namespace Microsoft.DotNet.Tools.Build
{ {
if (project.LockFile == null) if (project.LockFile == null)
{ {
var errorMessage = $"Project {project.ProjectName()} does not have a lock file."; var errorMessage = $"Project {project.ProjectName()} does not have a lock file. Please run \"dotnet restore\" to generate a new lock file.";
Reporter.Error.WriteLine(errorMessage); Reporter.Error.WriteLine(errorMessage);
throw new InvalidOperationException(errorMessage); throw new InvalidOperationException(errorMessage);
} }

View file

@ -79,6 +79,7 @@ namespace Microsoft.DotNet.Tools.Builder.Tests
buildResult = BuildProject(expectBuildFailure: true); buildResult = BuildProject(expectBuildFailure: true);
Assert.Contains("does not have a lock file", buildResult.StdErr); Assert.Contains("does not have a lock file", buildResult.StdErr);
Assert.Contains("dotnet restore", buildResult.StdErr);
} }
[Fact] [Fact]