.Net - interop assemblies taking 15 seconds to load when being referenced in a function
Posted
by Jon
on Stack Overflow
See other posts from Stack Overflow
or by Jon
Published on 2008-11-10T23:01:00Z
Indexed on
2010/03/24
4:43 UTC
Read the original article
Hit count: 214
This is a C# console application. I have a function that does something like this:
static void foo()
{
Application powerpointApp;
Presentation presentation = null;
powerpointApp = new Microsoft.Office.Interop.PowerPoint.ApplicationClass();
}
That's all it does. When it is called there is a fifteen second delay before the function gets hit. I added something like this:
static void MyAssemblyLoadEventHandler(object sender, AssemblyLoadEventArgs args)
{
Console.WriteLine(DateTime.Now.ToString() + " ASSEMBLY LOADED: " + args.LoadedAssembly.FullName);
Console.WriteLine();
}
This gets fired telling me that my interop assemblies have been loaded about 10 milliseconds before my foo function gets hit. What can I do about this? The program needs to call this function (and eventually do something else) once and then exit so I need for these assemblies to be cached or something. Ideas?
© Stack Overflow or respective owner