C
C#13mo ago
jim

❔ Professor issue.

I'm unsure why my professor is seeing this pop up when he runs my code. I downloaded the zip file I sent to my professor and the zip code works fine. Anyone know why he gets this error while i don't?
No description
81 Replies
SG97
SG9713mo ago
is that pathing related to your computer? c:\users\HungIntelSsd....
Trinitek
Trinitek13mo ago
also my thought; open your csproj in a text editor, what does it look like?
jim
jimOP13mo ago
yeag its my name iin there
jim
jimOP13mo ago
No description
No description
SG97
SG9713mo ago
that's options
jim
jimOP13mo ago
what does he mean open in text editor?
SG97
SG9713mo ago
literally open the csproj file in an editor, like notepad
jim
jimOP13mo ago
No description
Omnissiah
Omnissiah13mo ago
is it a net framework project or net core? iirc net framework had explicit .cs path in the csproj
jim
jimOP13mo ago
framework
Omnissiah
Omnissiah13mo ago
(also, doesn't the professor know how to deal with this?) (i mean, he could just remove and re-add the files to the project)
jim
jimOP13mo ago
im gonna wait to see what the professor responds with tommorow
Pobiega
Pobiega13mo ago
Open the csproj, not the solution
jim
jimOP13mo ago
what do you mean by this?
Pobiega
Pobiega13mo ago
Exactly what I wrote You showed the wrong file
jim
jimOP13mo ago
I'm a beginner so I'm not sure what you meant by wrong file I opened what I usually opened
Pobiega
Pobiega13mo ago
You know how files have "file extensions", right? Like .exe .txt .dol etc
jim
jimOP13mo ago
Yes
Pobiega
Pobiega13mo ago
You showed the .sln file, we need to see the .csproj file
jim
jimOP13mo ago
Alright got it
jim
jimOP13mo ago
No description
Pobiega
Pobiega13mo ago
Still the wrong file
jim
jimOP13mo ago
whys that?
Pobiega
Pobiega13mo ago
This is your .cs file What file extension do we keep asking for?
jim
jimOP13mo ago
The project
Pobiega
Pobiega13mo ago
Which is ...
jim
jimOP13mo ago
No description
jim
jimOP13mo ago
i mean it says this is the project file
Pobiega
Pobiega13mo ago
Yes That's the one we want to see
jim
jimOP13mo ago
That was what I opened
Pobiega
Pobiega13mo ago
Open it in a text editor
jim
jimOP13mo ago
alright Ah I see
jim
jimOP13mo ago
No description
SG97
SG9713mo ago
there we go
Pobiega
Pobiega13mo ago
Remove that itemgroup and it's content
jim
jimOP13mo ago
In both lines 10 and 12?
Pobiega
Pobiega13mo ago
10,11,12
SG97
SG9713mo ago
(and save)
jim
jimOP13mo ago
saved So what exactly did that do for the program?
Pobiega
Pobiega13mo ago
You were linking in another cs file from outside the project directory Based on your program.cs file, the code in that file wasn't being used anyways
jim
jimOP13mo ago
Would my professor still see the same error if I were to resubmit?
Pobiega
Pobiega13mo ago
Try to compile and run your program now If it works, you can do a clean and zip it up and send it
jim
jimOP13mo ago
My program worked from the very beginning it just didn't work for him
Pobiega
Pobiega13mo ago
I'm aware But you changed it just now
jim
jimOP13mo ago
yeah It works when I run it
Pobiega
Pobiega13mo ago
So let's verify that your changes didn't break it Okay, then do a clean then zip it
jim
jimOP13mo ago
alright @Pobiega oh so it now doesn't work anymore after the clean The change did break it
Pobiega
Pobiega13mo ago
What errors? Because your program.cs file doesn't refer to the other file at all
jim
jimOP13mo ago
No description
jim
jimOP13mo ago
This was a result of removing item group
Pobiega
Pobiega13mo ago
Nooe It's not. The real errors are in the log below Your "NguyenProgram4.cs" file contains another Main method
jim
jimOP13mo ago
what that mean?
Pobiega
Pobiega13mo ago
It means you are copypasting files blindly and it breaks shit
jim
jimOP13mo ago
oh So I gotta delete the copies?
Pobiega
Pobiega13mo ago
Any .cs file inside your project directory will be included in a compilation A single project must only have one main method
jim
jimOP13mo ago
How do I get rid of the extra main methods?
Pobiega
Pobiega13mo ago
How about you give it a try? I'm getting the distinct feeling you are not even trying to understand this yourself
jim
jimOP13mo ago
I'm giving it a try and I can't find a way to get rid of them
SG97
SG9713mo ago
what's inside Program.cs hint: it says so in the error log
jim
jimOP13mo ago
I'm not finding what's wrong with it. The errors don't tell me exactly what it is
SG97
SG9713mo ago
what is inside Program.cs wait
jim
jimOP13mo ago
I really am not sure
SG97
SG9713mo ago
what's inside NguyenProgram4.cs
jim
jimOP13mo ago
The same as program.cs
SG97
SG9713mo ago
why
jim
jimOP13mo ago
That's how it resulted
SG97
SG9713mo ago
well, that's not going to work
jim
jimOP13mo ago
I know I got to possibly remove something but I have no clue how to or where to even start
Pobiega
Pobiega13mo ago
Why would your program need the same thing twice, in two files? where is the logic in that
jim
jimOP13mo ago
I see that wait....
jim
jimOP13mo ago
I figured out how to delete it Oh my god It works now
SG97
SG9713mo ago
hopefully either of the files got deleted
jim
jimOP13mo ago
it did Now I have zero errors and zero warnings
SG97
SG9713mo ago
there we go, errors are really important to read and duplicate code is always bad
jim
jimOP13mo ago
Thank you for the help guys
Pobiega
Pobiega13mo ago
you're welcome. do try and learn the lesson here that errors are to HELP you, not to be "omg something is wrong" about
jim
jimOP13mo ago
Professor rechecked my code and he pasted the code into a new console log and it worked for him. We didn't have to do any of this 😂
Trinitek
Trinitek13mo ago
I'm hoping you remember to not do whatever you did to fuck up your csproj file, so this wasn't a complete waste of time
jim
jimOP13mo ago
I wouldn't call this a waste of time bc I still learned what not to do 🙂
Accord
Accord13mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server