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#

How can I recreate these two documents in visual studio?

I'm not sure how to set up the documents so that I can follow along with the video. I'm unable to use the "Tower" class inside of the game file.

Jon Wood
Jon Wood
9,884 Points

If I understand correctly, you should be able to just create a new solution and project (I'm guessing a console project) when you start up Visual Studio. From there you can add new files into the project as needed.

I have no difficulty creating the two files. The problem is that whenever I try to create the "Tower" object in the game file the editor doesn't understand what I'm referring to. How can I solve this?

Jon Wood
Jon Wood
9,884 Points

Can you share a screenshot for what it's doing and how your project structure looks?

This is the link for the screenshots :

https://1drv.ms/f/s!ArBn6_lA8tuSi0j2nq2zjnr6vlrk

Jon Wood
Jon Wood
9,884 Points

My guess is that the Tower class may have a different namespace. I believe Visual Studio can import what you need. Click on where the red squigglies are and you should see a lightbulb icon. Click that and see if it gives you any options to reference the Tower class.

2 Answers

Jon Wood
Jon Wood
9,884 Points

Hey Axel Valdez I think I see what's going on. It looks like you have a C# project that has each class of the game. Try to make yours look like this:

Visual Studio Project

You can just move each of the files from the other projects into the Game project and remove the remaining projects after that. Hope that helps!

Thank you very much Jon Wood, that fixed everything.

Jon Wood
Jon Wood
9,884 Points

Awesome! Glad it helped!

James Churchill
STAFF
James Churchill
Treehouse Teacher

Axel,

Any chance you could upload your Visual Studio project to OneDrive or a GitHub repo?

Thanks ~James