【发布时间】:2020-10-26 01:58:50
【问题描述】:
我正在尝试使用 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 the type or namespace name 'App' could not be found (are you missing a using directive or an assembly reference?),但它没有修复它。
我的 IDE 是 Visual Studio Community:Microsoft Visual Studio Community 2019 Version 16.6.2 和 dotnet --version 提供:5.0.100-preview.6.20318.15
非常感谢。
【问题讨论】:
标签: c# visual-studio blazor-webassembly .net-5