Add error message when tool is not restored
This commit is contained in:
parent
e37b055f1d
commit
ccfb4135c4
4 changed files with 55 additions and 1 deletions
|
@ -0,0 +1,23 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp1.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="**\*.cs" />
|
||||||
|
<EmbeddedResource Include="**\*.resx" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NETCore.App" Version="1.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<DotNetCliToolReference Include="dotnet-nonexistingtool">
|
||||||
|
<Version>1.0.0</Version>
|
||||||
|
</DotNetCliToolReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
|
@ -0,0 +1,12 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ConsoleApplication
|
||||||
|
{
|
||||||
|
public class Program
|
||||||
|
{
|
||||||
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Hello World!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -75,6 +75,11 @@ namespace Microsoft.DotNet.Cli.Utils
|
||||||
var availableVersions = new List<NuGetVersion>();
|
var availableVersions = new List<NuGetVersion>();
|
||||||
|
|
||||||
var toolBase = GetBaseToolPath(packageId);
|
var toolBase = GetBaseToolPath(packageId);
|
||||||
|
if (!Directory.Exists(toolBase))
|
||||||
|
{
|
||||||
|
return new NuGetVersion[0];
|
||||||
|
}
|
||||||
|
|
||||||
var versionDirectories = Directory.EnumerateDirectories(toolBase);
|
var versionDirectories = Directory.EnumerateDirectories(toolBase);
|
||||||
|
|
||||||
foreach (var versionDirectory in versionDirectories)
|
foreach (var versionDirectory in versionDirectories)
|
||||||
|
|
|
@ -124,6 +124,20 @@ namespace Microsoft.DotNet.Tests
|
||||||
.And.Pass();
|
.And.Pass();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void ItShowsErrorWhenToolIsNotRestored()
|
||||||
|
{
|
||||||
|
var testInstance = TestAssets.Get("NonRestoredTestProjects", "AppWithNonExistingToolDependency")
|
||||||
|
.CreateInstance()
|
||||||
|
.WithSourceFiles();
|
||||||
|
|
||||||
|
new TestCommand("dotnet")
|
||||||
|
.WithWorkingDirectory(testInstance.Root)
|
||||||
|
.ExecuteWithCapturedOutput("nonexistingtool")
|
||||||
|
.Should().Fail()
|
||||||
|
.And.HaveStdErrContaining("Version for package `dotnet-nonexistingtool` could not be resolved.");
|
||||||
|
}
|
||||||
|
|
||||||
// need conditional theories so we can skip on non-Windows
|
// need conditional theories so we can skip on non-Windows
|
||||||
//[Theory(Skip="https://github.com/dotnet/cli/issues/4514")]
|
//[Theory(Skip="https://github.com/dotnet/cli/issues/4514")]
|
||||||
//[MemberData("DependencyToolArguments")]
|
//[MemberData("DependencyToolArguments")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue