'Error CS0246 The type or namespace name 'ErrorModel' could not be found (are you missing a using directive or an assembly reference?)

Hi I am facing following error while building an MVC core application.

Severity Code Description Project Line Suppression State File Error CS0246 The type or namespace name 'ErrorModel' could not be found (are you missing a using directive or an assembly reference?) JSViewer_Angular(Core) 86 Active C:\Users\user\Desktop\JSViewer_Angular(Core)\obj\Debug\net462\Razor\Pages\Error.g.cshtml.cs

Any ideas behind this error.



Solution 1:[1]

Check your namespaces in your project. I got this when I renamed my root namespace and project file and I forgot one reference in the _ViewImports.cshtml file.

Solution 2:[2]

Maybe you have renamed project or moved around namespaces? Check in Pages/_ViewImports.cshtml if @using and @namespace are correct

Solution 3:[3]

I think you might have forgotten to add your model reference or directory to your assembly, or else there might be a problem with added references.

Solution 4:[4]

I had this error now, I only publish working app and make some minor changes and this error about 'ErrorModel' is missong shows up.. I work it with custom ErrorModel.cs added simple as possible:

public class ErrorModel : PageModel
{
    public string Code { get; set; }

    public void OnGet([FromQuery]int code)
    {
        if (code > 0)
        {
            this.Code = "Status Code: " + code;
        }
    }
}

And change of @if (Model.ShowRequestId) of on:

<h3>@Model.Code</h3>

Now its compiled without any errors.. But as I said.. don't know the cause of this error..

Solution 5:[5]

You had to loop trough the different colors and repeat the animation for each of them. Here's my code (only the second loop, the rest remains the same.):

# exit only when user clicks on exit button
while running:

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            exit()
    screen.fill((0, 0, 0))
    #prevent the animation from continuing forever
    if moveoutside:
        #loop trough different colors
        for circlecolor in listCircleColor:
            #reset loop variables to prevent weird things
            trangleedge=radius
            movetimes=1
            while movetimes <= 100:
                
                trangleedge = trangleedge + 1
                              #only redraw circles with a certain color
                for circle in [x for x in circles if x[1]==circlecolor]:
                    #x = circle[0][0]
                    #y = circle[0][1]
                    alpha = circle[2]
                    cl = circle[1]

                    if alpha > 0 and alpha < 90:
                        x = 300 + trangleedge * math.cos(math.radians(alpha))
                        y = 300 + trangleedge * math.sin(math.radians(alpha))
                        #pygame.draw.circle(screen, cl, (x, y), radius, width=2)
                        # second quarter of circles
                    if alpha > 90 and alpha < 180:
                        x = 300 - trangleedge * math.cos(math.radians(180 - alpha))
                        y = 300 + trangleedge * math.sin(math.radians(180 - alpha))
                        #pygame.draw.circle(screen, cl, (x, y), radius, width=2)
                        # third quarter of circles
                    if alpha > 180 and alpha < 270:
                        x = 300 - trangleedge * math.cos(math.radians(alpha - 180))
                        y = 300 - trangleedge * math.sin(math.radians(alpha - 180))
                        #pygame.draw.circle(screen, cl, (x, y), radius, width=2)
                        # last quarter of circles
                    if alpha > 270 and alpha < 360:
                        x = 300 + trangleedge * math.cos(math.radians(360 - alpha))
                        y = 300 - trangleedge * math.sin(math.radians(360 - alpha))
                        #pygame.draw.circle(screen, cl, (x, y), radius, width=2)

                    circle[0][0] = x
                    circle[0][1] = y
                    screen.fill((0, 0, 0))
                    for center, color, alpha in circles:
                        pygame.draw.circle(screen, color, center, radius, 2)

                    pygame.display.flip()
                clock.tick(60)
                movetimes += 1
        #prevent the animation from continuing forever
        moveoutside=False

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 GeniusCodeMonkey
Solution 2 Algis
Solution 3 Haritha M
Solution 4 Keyser Söze
Solution 5 The_spider