0

I'm trying to make a web api in C#, and there was an error. There are two solutions I'm using for this (I was following two separate tutorials) and I imported one into the other to make sure the classes were available. This was working fine for a while, but now the changes I made to the imported files aren't updating; the code is crashing on an empty line where I'm pretty sure there was a errant line of code before, leading me to think somehow the compiler isn't getting my new code.

When I run the debugger and step into these external files, I get the alert that "Source File: (dir of imported class) Module: \Appdata\Local\Temp\Temporary\ASP.NET Files\vs...\FormUI.exe (the project I'm importing) Process: [18324] issexpress.exe The source file is different from when the module was built. Would you like the debugger to use it anyway?" Selecting yes gives what I assume is old code (but VS displays the new code, leading to a crash on what seems to be a empty line), while selecting no lets me select the file manually. Doing so just repeats the prompt.

I've tried following this and clean/rebuilding to no avail.

Solution

In my %LocalAppData%\Microsoft\WebsiteCache folder, I found there was a duplicate a folder named after my solution. After cutting the properties from the duplicate and pasting it into the original (which was empty), my code worked again. I suspect this happened due to me adding the project to another solution and then removing it after consideration.

1 Answers1

0

Step 1 - Clean the Solution

Step 2 - Examine the Full Path to the file in the Properties pane, where VS is getting your file directory from.

Step 3 - Hover your mouse over your opened file's tab and check that path. Should be at the top of your screen's window and visible via a Tooltip.

Step 4 - Compare Step 2 and Step 3's results Chances are that the Properties pane's Full Path is not the same path as the opened files directory... you are opening and editing a file with the same name as your solution file, but it is in another directory...

You've simply opened a duplicate named file, which is not in your solution...but because it has the same name as the file in your solution...you think it is the correct file you are changing.

  • The files aren't in the web api's solution, but I'm importing it from another project. I checked while in the second, imported solution and the paths are consistent. – user9931080 Jun 12 '18 at 16:49
  • After messing around in %LocalAppData%\Microsoft\WebsiteCache I found there were two folders with my solution name! after copying the files from the duplicate into the original, that fixed it. – user9931080 Jun 12 '18 at 16:58