The type or namespace name 'TMPro' could not be found (are you missing a using directive or an assembly reference?) code example

Example 1: dot net core 3.1 The type or namespace name 'TestClassAttribute' could not be found (are you missing a using directive or an assembly reference?)

1. Close Visual Studio
2. Delete .vs folder
3. Reopen Visual Studio and it should work.

Example 2: The type or namespace name 'MovieContext' could not be found (are you missing a using directive or an assembly reference?)

if (Environment.IsDevelopment())
        {
            services.AddDbContext<RazorPagesMovieContext>(options =>
            options.UseSqlite(
                Configuration.GetConnectionString("MovieContext")));
        }
       else
        {
            services.AddDbContext<RazorPagesMovieContext>(options =>
            options.UseSqlServer(
                Configuration.GetConnectionString("MovieContext")));
        }