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 Creating a Controller

I can't pass Task 1 on the VideoGamesController.cs. I have looked for answers but can't figure out what I'm doing wrong.

I've tried adding : Controller at the end of the class but that doesn't work either. My errors that return back to me are about the "}" , however, I believe they're in the right place. Not sure what's going on.

Error message: VideoGamesController.cs(16,0): error CS1525: Unexpected symbol }' VideoGamesController.cs(16,1): error CS1514: Unexpected symbol}', expecting .' or{' Compilation failed: 2 error(s), 0 warnings

using System.Web.Mvc;

namespace Treehouse.Controllers
    public class VideoGamesController

1 Answer

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi there! Yes, you will need the : Controller to tell it to inherit from the Controller base class. But don't forget that each class needs its own open and closed curly braces (even if there's nothing inside them yet). It will continue to issue a compiler warning because it needs the curly braces to continue.

This is the line you're looking for:

public class VideoGamesController : Controller {}

Hope this helps! :sparkles:

It worked! Thank you so much! Now I know to include the curly braces even if there isn't any code in it yet.