Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

C# ASP.NET MVC Basics Controllers Overview of URL Routing

Dmitri Mikhalev
Dmitri Mikhalev
2,717 Points

Program.cs, URL's, ComicBooksController.cs and so on

Hi there,

So I am on the video (Overview on URL-routing (Asp.net) and things don't really look the same for me all the time in Visual Studio, since some years have passed and I have a newer version and whatnot.. anyway, I'm fine with that...

but when I try to run the page, as in the video, I am unable to. Instead, I get to a page that says "Hello World!"..

so I've looked around, and I see this "program.cs" file in my project directory, that looks like this inside:

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.MapGet("/", () => "Hello World!");


if I remove the stuff in it, I get a build error. (something about no Main method in that file)

and if I don't, I can't seem to be able to follow along the video here.

What should I do about it? Remove it alltogether?

Best regards, Dmitri