1
votes

When I try and build my sln I am getting this error. Not really sure what's going on.

------ Build started: Project: a2-comp2084, Configuration: Debug Any CPU ------ C:\Users\Kayley\Desktop\assignment2\a2-comp2084\a2-comp2084\Models\Authors.cs(25,36,25,42): error CS0246: The type or namespace name 'Comics' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Kayley\Desktop\assignment2\a2-comp2084\a2-comp2084\Models\comics.Context.cs(29,30,29,36): error CS0246: The type or namespace name 'Comics' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Kayley\Desktop\assignment2\a2-comp2084\a2-comp2084\Models\Publishers.cs(25,36,25,42): error CS0246: The type or namespace name 'Comics' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Kayley\Desktop\assignment2\a2-comp2084\a2-comp2084\Models\Users.cs(29,36,29,42): error CS0246: The type or namespace name 'Comics' could not be found (are you missing a using directive or an assembly reference?) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This is the github link to the project, if anyone could help figure out what I'm doing wrong, I'd really appreciate it!

https://github.com/krl87/a2

Thanks, Kayley

2
\Models\comics.cs doesn't have any codes. And I notice that this file name differ to others. Did you manually add this file to your project or you've edited it? - Zen

2 Answers

0
votes

Each Microsoft compiler error message includes a unique code - in your particular case that code is CS0246. If you search the web for that code you should find a page that describes the error in more detail like this one for CS0246.

0
votes

It seems like something went wrong when the edmx was created / altered.
There is a naming conflict between the table (class) Comics and the navigation propery "Comics" on Authors/Publishers/Users.

I am not sure if this was an example code you have modified or your own DB design but you can do this - Rename the Comics table in the designer to ComicsTab by right clicking in the designer on the Comics table -> refactor -> rename.
Now rebuild, that would allow the model to be generated and a proper ComicsTab class to be generated.

Still, You will have compilation errors due to other parts in the code referencing wrong property names (like Users instead of Users1).

I think you should carefully go over the model and your DB schema and make sure they match and that there are no more naming conflicts. Also, don't name the model itself like a Class within it - At best it would confuse you, at worst some generated code might get crazy on you. (I think that is what happened here)