.net-core - .Net Core The name 'Host' does not exist
问题描述
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.
解决方案
推荐阅读
- reactjs - React.js localhost 拒绝连接
- c# - 无法获取 Events.CacheAttached 以识别 Acuamtica 中的自定义属性
- java - 在通过 Lombok 的“@Slf4j”注释创建的“log”对象中找不到 error()、debug()、info() 方法
- reactjs - 使用 GraphQL 和 IntersectionObserver 的无限滚动组件
- r - 在 R vistime 上使用天数
- c# - 使用 Rider 的 Specflow 新插件构建项目并创建 .feature.cs 文件
- css - 转换旋转()在 Firefox 中无法按预期工作
- r - 根据一列值是否介于其他两个列值之间(范围),将新列添加到带有标签的数据框
- typescript - 从泛型类调用类的静态方法
- excel - customtab 和 contextcellmenu :按钮激活/取消激活