Question

All,

I'm working on a SharePoint project, but this isn't a SharePoint-specific question per-se. I have an assembly I've deployed to a SharePoint farm, and I'd like to verify whether my "newest version" is sitting in the GAC, or if an older version from late yesterday is sitting there instead. This is a test farm, so yes, we are revving versions constantly.

Without doing anything crazy like changing the assembly version itself every time I compile*, is there some assembly property I can check (or set at compile-time)?

*I should clarify, in SharePoint projects we hardcode the assembly's full name in multiple places (including XML files), so changing the assembly version is a less savory option than you might think.

Was it helpful?

Solution

Assembly Version is the intended mechanism for this, but you could roll your own by comparing an MD5 hash of the GAC assembly with the MD5 of your latest version.

OTHER TIPS

You could use AssemblyFileVersion attribute. From the docs, the AssemblyFileVersion

Instructs a complier to use a specific version number for the Win32 file version resource. The Win32 file version is not required to be the same as the assembly's version number.

You might also want to look at assembly binding redirection. Basically you can put a few settings in the web.config or app.config to tell your app (SharePoint in this case) to use a specific version number:

More info: http://msdn.microsoft.com/en-us/library/7wd6ex19(VS.71).aspx

It may not be the solution for this case, but it might prove useful in the future. I particularly found it useful when dealing with custom SharePoint solutions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top