How do I get the version of an assembly without loading it?

I found the following in this article. using System.Reflection; using System.IO; … // Get current and updated assemblies AssemblyName currentAssemblyName = AssemblyName.GetAssemblyName(currentAssemblyPath); AssemblyName updatedAssemblyName = AssemblyName.GetAssemblyName(updatedAssemblyPath); // Compare both versions if (updatedAssemblyName.Version.CompareTo(currentAssemblyName.Version) <= 0) { // There’s nothing to update return; } // Update older version File.Copy(updatedAssemblyPath, currentAssemblyPath, true);

Does .NET assembly size affect performance?

From Microsoft’s Patterns & Practices Improving .NET Application Performance and Scalability Chapter 5: Prefer Single Large Assemblies Rather Than Multiple Smaller Assemblies To help reduce your application’s working set, you should prefer single larger assemblies rather than multiple smaller assemblies. If you have several assemblies that are always loaded together, you should combine them and … Read more

AppDomain.CurrentDomain.AssemblyResolve asking for a .resources assembly?

Answering on my own; Adding this line to AssemblyInfo.cs solves it and resolver will not get asked for resources any-more. [assembly: NeutralResourcesLanguageAttribute(“en-US”, UltimateResourceFallbackLocation.MainAssembly)] Though this is a work-around should be carefully considered multi-language applications. More Info: https://connect.microsoft.com/VisualStudio/feedback/details/526836/wpf-appdomain-assemblyresolve-being-called-when-it-shouldnt http://blogs.msdn.com/b/kimhamil/archive/2008/11/11/what-does-the-neutralresourceslanguageattribute-do.aspx http://forums.devshed.com/net-development-87/c-wpf-appdomain-assemblyresolve-being-called-when-it-shouldn-t-669567.html http://blogs.msdn.com/b/microsoft_press/archive/2010/02/03/jeffrey-richter-excerpt-2-from-clr-via-c-third-edition.aspx This approach fails for machines with non en-US cultures. A better approach is ignoring resources … Read more

Assembly binding redirect does not work

Any typo in configuration xml can be a cause. Loader just can’t see your configuration. I also had a hour of headache until I realize that the error was in character “=” instead of “-” in schema name: <assemblyBinding xmlns=”urn:schemas=microsoft-com:asm.v1″> Just check carefully all attribute names and values. I guess “PublicKeyToken” should be “publicKeyToken” This … Read more

How do I list all loaded assemblies?

Using Visual Studio Attach a debugger to the process (e.g. start with debugging or Debug > Attach to process) While debugging, show the Modules window (Debug > Windows > Modules) This gives details about each assembly, app domain and has a few options to load symbols (i.e. pdb files that contain debug information). Using Process … Read more