Skip to main content

Patching your .Net website

Whilst re-compiling and re-deploying your entire .Net website application is the “safe” solution to avoid any nasty version conflicts etc its also slow (and a sledge-hammer to crack a nut).

If you are running a live website you often just want a quick patch to fix the issue at hand – often just a single assembly.

If you are lucky (like I was) you have a good build manager to do all this for you… but I have found that people are not always aware of the options available – they just use the Visual Studio GUI to re-compile the entire solution every time.

If you are using Visual Studio to do the build there is no requirement to re-build the entire solution (.sln) every time - you can just rebuild a project (.proj) within the solution so you get just the single assembly. Note that "Build" will only compile changes anyway, "rebuild" will re-compile everything whether it has changed or not.

It's worth moving away from using the GUI (if you haven't already) to using MSBuild.

MSBuild is a dark art to me but there is a lot of reference material out there (http://msdn.microsoft.com/en-us/library/ms171452.aspx , http://blogs.msdn.com/msbuild/ ).

There is also NANT, of course - http://nant.sourceforge.net/http://social.msdn.microsoft.com/forums/en-US/msbuild/thread/994761a3-ea9d-40c7-8d4f-4c208b2023f6/ ,  

Regardless of HOW you build you still need to ensure that you maintain the linkages between the different parts of you application.

There are a number of different ways of doing this to ensure that you maintain the linkages between assemblies.

 

Keeping a static version number

The “easiest way” is to just not change the assembly version number (AssemblyVersionInfo.cs) – to the rest of the site it still looks like the “same version”. You can change the AssemblyFileVersion if you want  so the Operations people can distinguish between the two different version DLL’s on the server (assembly file version is that number you see when you look at the properties of a file in Window Explorer).

[assembly: AssemblyVersion("1.0.262.0")]

[assembly: AssemblyFileVersion("1.0.397.0")]

 

Using Publisher Policy Assembly Redirection

The better way is to use “policy redirection” i.e. use policy files to tell .Net to “give the application 1.1.1.2 even though it asked for 1.1.1.2”.

This is documented here - http://msdn.microsoft.com/en-us/library/7wd6ex19.aspx - but I have shown an example below of redirecting “all versions of ZZZ.Business.AdManager versions 1.0.*.* to version 1.0.262.0”.

<configuration>

  <runtime>

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

      <dependentAssembly>

        <assemblyIdentity name="ZZZ.Business.AdManager" publicKeyToken="6221fee78ae283c6" culture="neutral" />

        <bindingRedirect oldVersion="1.0.0.0-1.0.65535.65535" newVersion="1.0.262.0" />

      </dependentAssembly>

    </assemblyBinding>

  </runtime>

</configuration>

Note that this can be done at different levels too – publisher policy for the assembly, application level and at machine level (machine.config).

There are some pre-requisites e.g. “strong names” but these are easily created as part of the assembly process and you need strong naming if you want to share stuff in the GAC anyway.

 

Further Information

.NET Framework Tutorials - Versioning Components

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptutorials/html/versioning_components.asp

Managing Versions of an Application

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/managevers.asp

The Build Process

http://msdn.microsoft.com/en-us/library/ms998223.aspx

Simplifying Deployment and Solving DLL Hell with the .NET Framework

http://msdn.microsoft.com/en-us/library/ms973843.aspx

VS 2005 Web Deployment Projects

http://weblogs.asp.net/scottgu/archive/2005/11/06/429723.aspx

Web Deployment Tool (even better with IIS7!!!)

http://learn.iis.net/page.aspx/346/web-deployment-tool/

I hope this is information is useful to your build manager and that we will be able to transition to a more flexible deployment strategy in coming releases!

Comments

Popular posts from this blog

So what else does Operations do? Well, there is a whole organisation run by the UK govermnent to help answer that question! ITIL , or the IT Infrastructure Library, is a library of best practice information that basically tells you everything you need to do to run an IT department. Similarly developers have development methodologies such as RAD, JAD, Agile/XP, and Project Managers have PM methodologies such as Prince 2, PMBok etc to cover off their areas in more specific detail. ITIL breaks it down into 7 key areas: Service Support - deals with the actual provision of IT services such as the service (help) desk, incident management, problem management, release management etc Service Delivery - deals with ensuring that you can continue to DELIVER the service support functions with things like contigency planning, capacity management, service levels etc The Business Perspective - helps to ensure that the IT function is aligned with the organisation's business strategy and that how to

Top 13 Website Crashes of 2010?

I was doing a bit of research for an article and I started compiling a list of high-profile website crashes in 2010. Pingdom have published a list here - http://www.readwriteweb.com/archives/major_internet_incidents_and_outages_of_2010.php as have Alertsite here - http://www.huffingtonpost.com/2010/12/29/the-biggest-web-outages-o_n_801943.html But I decided to compile my own list from a more UK-centric perspective and came up with my “baker’s dozen” below. # Site Date News Link 1 National Rail Jan-10 http://www.theregister.co.uk/2010/01/05/rail_chaos/ 2 Outnet Apr-10 http://www.guardian.co.uk/lifeandstyle/blog/2010/apr/16/outnet-sale-website-crash 3 Apple (iPhone 4 Launch) Jun-10 http://www.dailymail.co.uk/sciencetech/article-1286756/Apple-iPhone-4-pre-order-Website-crashes-new-iPhone-goes-sale.html 4 ITV.com (World C

Real-time Performance Analytics with Pion and WebTuna

One of my goals is to create an easy to implement real-time web performance analytics solution that doesn’t rely on fragile, inaccurate javascript tags and I have been playing around with an idea on the weekend. I used the performance measurement and analytics stream generation capabilities of Atomic Lab’s Pion to inspect the HTTP traffic directly off the network and measure the page load performance. I then used some simple Python scripting within Pion to generate a beacon to www.webtuna.com , a UK-based performance analytics provider. I then fired up webpagetest.org and generated some traffic from different nodes around the world and you can see the results graphically in the screen shot below. The end result is a proof of concept that works brilliantly to tell you who is on your website, where they come from, what pages they have visited… and how fast the page appeared to load from the end-user’s perspective. Keep in mind these are page load times, not server response