Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Blazor WebAssembly项目,Intellisense弹出一个错误:类型或命名空间名称';App&x27;找不到_C#_Visual Studio_Blazor Webassembly_.net 5 - Fatal编程技术网

C# Blazor WebAssembly项目,Intellisense弹出一个错误:类型或命名空间名称';App&x27;找不到

C# Blazor WebAssembly项目,Intellisense弹出一个错误:类型或命名空间名称';App&x27;找不到,c#,visual-studio,blazor-webassembly,.net-5,C#,Visual Studio,Blazor Webassembly,.net 5,我正在尝试使用Blazor WebAssembly。 我创建了一个项目,代码是isL public class Program { public static async Task Main(string[] args) { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add<App>("app");

我正在尝试使用Blazor WebAssembly。 我创建了一个项目,代码是isL

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();
    }
}
公共类程序
{
公共静态异步任务主(字符串[]args)
{
var builder=WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add,但它没有修复它

我的IDE是Visual Studio Community:Microsoft Visual Studio Community 2019版本16.6.2和dotnet--版本为:5.0.100-preview.6.20318.15


非常感谢。

根据我的测试,我发现问题在于vs的版本

我建议您使用最新的vs2019预览打开它

我使用了以下vs2019预览版本,没有任何问题


根据我的测试,我发现问题在于vs的版本

我建议您使用最新的vs2019预览打开它

我使用了以下vs2019预览版本,没有任何问题


正如Jack J Jun建议的那样,我安装了VS的预览版。
它起作用了。但我一安装扩展CodeMaid,错误就回来了。当我停用CodeMaid时,错误消失了。

正如Jack J Jun所建议的,我安装了VS的预览版。
它起作用了。但我一安装扩展名CodeMaid,错误就回来了。当我停用CodeMaid时,错误消失了。

确保项目使用的所有软件包都已更新并与.net 5兼容

更新这两个包为我解决了问题:

Microsoft.AspNetCore.Components.WebAssembly
Microsoft.AspNetCore.Components.WebAssembly.DevServer

请确保项目使用的所有包都已更新并与.net 5兼容

更新这两个包为我解决了问题:

Microsoft.AspNetCore.Components.WebAssembly
Microsoft.AspNetCore.Components.WebAssembly.DevServer

非常感谢您的回复,我现在安装了预览版本,并且我测试它在预览中工作得很好。非常感谢。好的,在我安装了一些VS2019预览扩展之后,错误又回来了。我正在寻找引发此错误的人。非常感谢您的回复eply,我现在安装了预览版本,我测试了它在预览中的工作情况。非常感谢。好的,在我安装了一些VS 2019预览的扩展之后,错误又回来了。我正在寻找引发此错误的人。