Today I wasted an hour or two chasing my tail around trying to figure out why a change to one of my ASP.NET MVC Views was not at all showing any changes in my jQuery Mobile version. I cleared my cache, hit ctrl+F5 a billion times, redeployed to our test server and then again. I double checked my code, then again. I would view source and on my mobile version it hadn’t changed. What is going on?
I noticed another oddity through all this. My page was loading up two versions of jQuery. One being an older version I know I updated.
Yet, it was loading. Huh? I’m confused.
Then it hit me. Bundling in ASP.NET MVC looks for whatever version I have in the scripts folder to generate the tag since my syntax is:
Does this mean I have the older version along with the newer version on my test server.
Inspecting the test server revealed this to be the case. I then went to my view folder for the mysterious view that wasn’t changing and found a very old .mobile.cshtml file that we ditched a while back once we were able to consolidate our normal and mobile view on one page.
So how did this happen. We’re a small shop and use Web Publish built into Visual Studio to deploy to our servers. I looked at the file publish options and the "Remove additional files at destination" was unchecked.
Leaving this unchecked means that any file you removed from your project if on the destination machine will not be removed.
Delete some views, update your jQuery nuget packages and publish without this checked and the old items will remain on your deployed environment.
A simple check of the box and all is well again.
Luckily, our production server deploy settings were correct so we didn’t have to worry about some nasty little bug in production due to this.