Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3610366
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:44:35+00:00 2026-05-18T21:44:35+00:00

I have implemented the fusion.dll wrapper mentioned in many posts and now find that

  • 0

I have implemented the fusion.dll wrapper mentioned in many posts and now find that at least one dll I need to determine if it needs to be updated is not using build and revision numbers. Consequently I cannot compare on version numbers and need to compare on Last Modified date.

fusion.dll or it’s wrappers have no such method which I guess is fair enough but how do I determine the ‘real’ path of the dll so that I can discovers it’s last Modified date.

My code so far:

private DateTime getGACVersionLastModified(string DLLName)
{
  FileInfo fi = new FileInfo(DLLName);
  string dllName = fi.Name.Replace(fi.Extension, "");

  DateTime versionDT = new DateTime(1960,01,01);

  IAssemblyEnum ae = AssemblyCache.CreateGACEnum();
  IAssemblyName an;
  AssemblyName name;
  while (AssemblyCache.GetNextAssembly(ae, out an) == 0)
  {
    try
    {
      name = GetAssemblyName(an);

      if (string.Compare(name.Name, dllName, true) == 0)
      {
        FileInfo dllfi = new FileInfo(string.Format("{0}.dll", name.Name));
        if (DateTime.Compare(dllfi.LastWriteTime, versionDT) >= 0)
          versionDT = dllfi.LastWriteTime;
      }
    }
    catch (Exception ex)
    {
      logger.FatalException("Unable to get version number: ", ex);
    }
  }
  return versionDT;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T21:44:36+00:00Added an answer on May 18, 2026 at 9:44 pm

    From the problem description in your question I can see there are really 2 primary tasks that you are trying to accomplish:

    1) Determine if a given assembly name can be loaded from the GAC.
    2) Return the file modified date for the given assembly.

    I believe these 2 points can be accomplished in a much simpler fashion and without having to work with the unmanaged fusion API. An easier way to go about this task might be as follows:

    static void Main(string[] args)
    {
      // Run the method with a few test values
      GetAssemblyDetail("System.Data"); // This should be in the GAC
      GetAssemblyDetail("YourAssemblyName");  // This might be in the GAC
      GetAssemblyDetail("ImaginaryAssembly"); // This just plain doesn't exist
    }
    
    private static DateTime? GetAssemblyDetail(string assemblyName)
    {
      Assembly a;
      a = Assembly.LoadWithPartialName(assemblyName);
      if (a != null)
      {
        Console.WriteLine("'{0}' is in GAC? {1}", assemblyName, a.GlobalAssemblyCache);
        FileInfo fi = new FileInfo(a.Location);
        Console.WriteLine("'{0}' Modified: {1}", assemblyName, fi.LastWriteTime);
        return fi.LastWriteTime;
      }
      else
      {
        Console.WriteLine("Assembly '{0}' not found", assemblyName);
        return null;
      }
    }
    

    An example of the resulting output:

    ‘System.Data’ is in GAC? True
    ‘System.Data’ Modified: 10/1/2010 9:32:27 AM
    ‘YourAssemblyName’ is in GAC? False
    ‘YourAssemblyName’ Modified: 12/30/2010 4:25:08 AM
    Assembly ‘ImaginaryAssembly’ not found

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented Facebook into my app but now I find that whenever I
I have implemented one matrix multiplication with boost::numeric::ublas::matrix (see my full, working boost code
I have implemented a UISearchDisplayController that allows users to search a table. Currently the
I have implemented a simple entity ejb with a @version annotation. I expect that
I have implemented an image blending method for seamless blending using plain C++. Now
UPDATE: I now have a solution I'm much happier with that, whilst not solving
I have implemented an eclipse plugin that it launches a java application when the
i have implemented a code that fetch single image from 1000+ images. The image
I have implemented a custom trace listener (derived from TextWriteTraceListener ) and now I
I have implemented my own RingBuffer , but I'm surprised to see that .NET

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.