Visual Studio 2017 Builds the code but runs a previous version.

lordnick69 1 Reputation point
2021-03-29T16:56:33.9+00:00

I have been working on a ASP.Net Web project (.Net 4.6.1) that was running fine on Friday. When I came in on Monday I made some small code changes to one page and tried to run the project to see what my changes would do. The project built and appeared to run but it didn't hit my break point. I put in several break points, one of them even at the default Page_Load and it never stopped. After much trial and error it appears that it is not actually running the code that it built but is instead running a previous build. How can I force it to run what it just built?

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,246 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
939 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,406 Reputation points
    2021-03-30T02:34:04.147+00:00

    Hi mbedell1,

    According to your description, this issue may be caused by the browser caches. You can try to follow these steps from this answer to disable browser caches, then re-debug your web application:

    1. Click Browse with... in the toolbar 82601-image.png
    2. Copy the path of the browser you need , then click Add 82598-image.png
    3. Paste the path of browser and add --disk-cache-dir=null in Arguments 82576-image.png

    Best Regards, Dylan


    If the answer is helpful, please click "Accept Answer" and upvote it. Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. Karen Payne MVP 35,036 Reputation points
    2021-03-29T17:09:44.263+00:00

    Close Visual Studio, in windows explorer, delete the obj and bin folders. Open Visual Studio to you project then in Solution Explorer right click, select configuration manager and verify the build is checked on the project. Do a clean then Rebuild the solution, watch for issues in the output window. See if that helps or not.

    Have you tried rebooting your computer too?


  3. Duane Arnold 3,211 Reputation points
    2021-03-30T03:20:28.547+00:00

    @lordnick69

    Well, the Web project code does not match the binary that has been pushed out to IIS is why the breakpoints are not being hit along with any other problems you are having.

    I suggest that you do a clean and rebuild, which should push the project out to local IIS.

    You can also just go to IIS and delete the Web site off of IIS, do a project clean and rebuild and push the solution back out to local IIS.

    The link may help.

    https://learn.microsoft.com/en-us/visualstudio/debugger/how-to-enable-debugging-for-aspnet-applications?view=vs-2017

    0 comments No comments