Reputation: 4094
I'm busy trying to get a .Net Core Host running but I keep getting a compiler error
error CS0103: The name 'Host' does not exist in the current context
I don't know if I am missing an import or package that is causing this but I am using .net core 5.0.402, the only package I added was Microsoft.AspNetCore
using System;
using System.Data;
using System.Dynamic;
using System.Collections.Generic;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
namespace TemporaryNamespace {
public class HostClass {
public HostClass(string[] args, string url, string port) {
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args);
}
}
I'm compiling on Debian 10 by the way, I don't know if that makes a difference.
Upvotes: 3
Views: 2326
Reputation: 303
Please install Microsoft.AspNetCore.App to your project and it will work.
Upvotes: 2