So how do you patch a deployed Nuget package

Quite some time ago, this blog post went past on the usual Microsoft RSS feed, discussing how Microsoft are going to make it possible to patch NuGet libraries. Using the standard mechanism of putting an assembly in the GAC and redirecting clients to use it via a publisher policy is a way to deploy a patch, but the article hints at an attribute that signals to Microsoft Update that such an updated assembly needs to be installed. I thought that it is was probably time to see what was happening.

Adding a NuGet reference to SignalR and then using Reflector to look at the assembly attributes, there is now a use of
[assembly: AssemblyMetadata(“Serviceable”, “True”)]
to flag the assembly to the runtime.

Looking in the CoreClr source code on github, in the assembly.cpp file there’s a GenerateBreadCrumbForServicing method which writes details about the assembly under c:\programData\Microsoft\NetFramework\BreadcrumbStore\ and sure enough when I look at that folder in explorer I see a mass of NuGet packages that my applications have loaded. These take the form of empty files with names such as

EntityFramework, Version=5.0.0.0, Culture=neutral,PublicKeyToken=b77a5c561934e089

It will be interesting to see how well this mechanism works in practice – if I xcopy deploy something, there is going to be a delay between the first time I load the assembly (leading to the breadcrumb being set) and Microsoft Update running and fixing it up. I’m also interested in what other AssemblyMetadata attribute values there are being used, but investigating that is going to have to wait.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s