While debugging in VS 2010, my code gives no error but on the output screen it shows the output of the other code file in the project.Please help.

Dani AI

Generated

Most often this kind of symptom comes from Visual Studio launching or attaching to the wrong binary or project. Common causes include the wrong StartUp project/object being selected, a web project starting a different page or virtual directory, an ambiguous Main when there are multiple entry points, a stale DLL being executed instead of the rebuilt assembly, or the debugger attached to a different process. 's question about multiple projects is on point, and 's note about "last good program" maps to stale or mismatched binaries/PDBs.

Recommended checks and quick diagnostics:

  • Confirm the StartUp project (Solution Explorer -> right-click -> Set as StartUp Project) or use Solution Properties -> Startup Project for multi-project solutions.
  • For console apps, check Project Properties -> Application -> Startup object so the intended Main is used.
  • For web apps, confirm the Start Page / Project Properties -> Web -> Start Action and verify the project URL or virtual directory.
  • Clean the solution, delete bin/obj folders, then Rebuild to remove stale DLLs.
  • Replace file references to compiled DLLs with project-to-project references so the correct assembly is built.
  • Use the Output window's dropdown to see which project/process is producing messages.
  • Open Debug -> Windows -> Modules to verify which assemblies and PDBs are loaded and their file paths, and use Debug -> Attach to Process when necessary.

If these checks still show the wrong output, the Modules window and timestamps on the loaded assemblies will reveal whether Visual Studio is executing an unexpected binary. Microsoft docs on setting the startup project and inspecting loaded modules are helpful references: and .

Recommended Answers

All 2 Replies

Please elaborate, don't understand it very well.
Do you have many projects in your solution?

send your code
if you have errors in your code VS runs last error less program that you are talking about

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.