Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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

Dmitri Mikhalev
Dmitri Mikhalev
4,462 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!");

app.Run();

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