Browse Source

Print error if there are no runnable services in the application. (#193)

pull/209/head
David Fowler 7 years ago
committed by GitHub
parent
commit
11ca89bf37
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/tye/BuildHost.cs
  2. 6
      src/tye/Program.DeployCommand.cs
  3. 6
      src/tye/Program.RunCommand.cs

6
src/tye/BuildHost.cs

@ -15,6 +15,12 @@ namespace Microsoft.Tye
{
var output = new OutputContext(console, verbosity);
var application = await ApplicationFactory.CreateAsync(output, path);
if (application.Services.Count == 0)
{
throw new CommandException($"No services found in \"{application.Source.Name}\"");
}
await ExecuteBuildAsync(output, application, environment: "production", interactive);
}

6
src/tye/Program.DeployCommand.cs

@ -39,6 +39,12 @@ namespace Microsoft.Tye
var output = new OutputContext(console, verbosity);
var application = await ApplicationFactory.CreateAsync(output, path);
if (application.Services.Count == 0)
{
throw new CommandException($"No services found in \"{application.Source.Name}\"");
}
await ExecuteDeployAsync(new OutputContext(console, verbosity), application, environment: "production", interactive, force);
});

6
src/tye/Program.RunCommand.cs

@ -5,6 +5,7 @@
using System;
using System.CommandLine;
using System.CommandLine.Invocation;
using System.CommandLine.IO;
using System.IO;
using System.Threading;
using Microsoft.Tye.ConfigModel;
@ -76,6 +77,11 @@ namespace Microsoft.Tye
InitializeThreadPoolSettings(serviceCount);
if (application.Services.Count == 0)
{
throw new CommandException($"No services found in \"{application.Source.Name}\"");
}
using var host = new TyeHost(application.ToHostingApplication(), args, debug);
await host.RunAsync();
});

Loading…
Cancel
Save