# Friday, 03 May 2013
« When validations fail. A story of view m... | Main | Oracle VirtualBox notes for a developer.... »

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. 

<script src="/Scripts/jquery-1.8.2.js"></script>
<script src="/Scripts/jquery-1.8.3.js"></script>

Yet, it was loading. Huh? I’m confused.

What’s Happening

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:

bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
    Does this mean I have the older version along with the newer version on my test server. 

folder

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.

publishOptions

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. Smile

Happy Coding!

OpenID
Please login with either your OpenID above, or your details below.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: b, blockquote@cite, em, i, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview