我正在尝试使用 Blazor WebAssembly。我创建了一个项目,代码是L
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("app"); // Error there : The type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?)
builder.Services.AddTransient(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
await builder.Build().RunAsync();
}
}
正如我在代码中评论的那样,智能感知未找到 App 并显示错误。我不能在“App”一词上使用 f12(未找到)。我可以构建和启动项目,但我想正确清理它。
我关注了这个线程:Blazor 找不到类型或命名空间名称“App”(您是否缺少 using 指令或程序集引用?)但它没有修复它。
我的 IDE 是 Visual Studio Community:Microsoft Visual Studio Community 2019 Version 16.6.2 和 dotnet --version 给出:5.0.100-preview.6.20318.15
非常感谢。