Visual Studio still run a code I deleted

CGC 20 Reputation points
2023-01-11T19:01:24.1933333+00:00

Hello,

When I write few lines of code inside VS 2022 and run it, works perfectly. But if I decide to modify something or even delete the entire code I wrote, when I press run, it's running the same code I had before. I don't know how, but somehow saves the first lines of code I wrote before and doesn't want to "forget" them.

How can I make VS to "forget" the old code, that I modified/deleted and to run the new code I wrote?

Thank you!

Developer technologies | Visual Studio | Debugging
Developer technologies | Visual Studio | Other
Developer technologies | C#
{count} votes

Accepted answer
  1. Karen Payne MVP 35,586 Reputation points Volunteer Moderator
    2023-01-11T21:24:33.3233333+00:00
    1. In Solution Explorer, right click on the project name
    2. Select Clean
    3. Select Rebuild

    If that does not do it, go out to the root of the project in Windows Explorer, delete the obj folder and bin folder, rebuild the project, if you happen to get an error run dotnet restore at the command prompt, then rebuild.

    2 people found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.