I'm sure that this is a bug of Visual Studio (2017 if it matters).
I would like to keep the project name short and simple but the project namespace should be verbose enough to follow my naming convention. So after creating the project, I changed the project namespace in the Application tab in project properties window. Building is OK, but debugging showed that there was some compilation error (will be soon posted below). I've Googled around and found out that the problem is in the web.config inside the Views folder, that looks like the last place the old namespace referenced. I've also tried changing it to the new one and the first time it seemed to work OK.
But now I've encountered that exact same issue again and of course the web.config file I fixed before is not changed to something wrong, the new namespace is there (replacing the old one). I've tried deleting all the cached files in /Local/Temp/Temporary ASP.NET Files, clean (manually deleting all files in /bin) and rebuild the project. Nothing worked. Still that same error. I've even tried restarting my computer and repeating the steps above but still nothing changed.
Here is the involved section in web.config:
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Optimization" />
<add namespace="System.Web.Routing" />
<add namespace="CS.MvcWebsite" />
</namespaces>
The new namespace here is CS.MvcWebsite, while the old one is WebSite (which is also the project name). When running, it shows the compilation error like this:
I wonder why the hell that could still be pulled out? looks like there is still some very hidden place where the cache is saved. I hope someone here has experienced with this and successfully worked-around it. I'm sure that almost encountering this should have been fine by modifying the web.config file (like what I did too) but as I said strangely that's not enough to force VS to use what is new, it looks really like a bug.
Update:
After suggesting of mjwills, I've also tried deleting the obj folder as well (as before only bin was cleaned). But still it does not help anyway.


objfolder as well, and it is still the same (that same error), thank you!