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# C# Objects Inheritance Throwing Exceptions

Does the namespace of all classes have to be the same name as the exe file's name?

TreehouseDefense is the namespace of all the classes in the project. If I compile the Game class as mcs Game.cs it gives me an error Are you missing an assembly reference? Does this mean The exe files name and all namespaces have to be the same?

2 Answers

Steven Parker
Steven Parker
229,644 Points

There's no requirement that the namespace(s) correspond with the output file name. But if I recall correctly, this project has more than one input file, so compiling any one by itself would be likely to produce that error.

To facilitate a complete analysis and more specific answer you can make a snapshot of your workspace and post the link to it here.

Ihor Bodnarchuk
Ihor Bodnarchuk
2,391 Points

They can be different since you can call .exe file whatever (remember -out: <name_you_picked> ?). just make sure you compile all of them by running mcs *.cs like Steven said