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