473,597 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delayed loading dependent assemblies when start an .Net application

Back in COM time, it's possible to use #import statement in cpp to
load COM object type info and use it at coding time. When the
application is started, the underlying COM DLL will not be loaded
until that part of code is called.

Is there a similar thing in .Net (C#) application ?

When I create C# application, I need to add reference to another
assembly if I want to use its classes (I don't want to use reflection
here). But this will also add dependency on that assembly. The
assembly will be loaded when my application starts. Is there a way to
delay the loading of dependent assemblies only when the code using it
is called?

T.I.A.

Mar 6 '07 #1
2 1848
Hi,

<wz*******@gmai l.comwrote in message
news:11******** *************@6 4g2000cwx.googl egroups.com...
Back in COM time, it's possible to use #import statement in cpp to
load COM object type info and use it at coding time. When the
application is started, the underlying COM DLL will not be loaded
until that part of code is called.

Is there a similar thing in .Net (C#) application ?

When I create C# application, I need to add reference to another
assembly if I want to use its classes (I don't want to use reflection
here). But this will also add dependency on that assembly. The
assembly will be loaded when my application starts. Is there a way to
delay the loading of dependent assemblies only when the code using it
is called?
You could figure out something using like a plug-in pattern, but do you
really need to delay it?

You can always delay the creation of instances until the last moment you
need it, but loading the assembly has not that much of overload to justify
delaying its load.


Mar 6 '07 #2
The CLR will load an assembnly only when it is absolutely necessary. The
delay-loading is built in. (check
http://www.awprofessional.com/articl...&seqNum=5&rl=1 for
a more detailed discussion of CLR loader.) You do not need to do anything
(nor you can).

By adding reference you are not forcing the assembly to be loaded at
startup.
If your code does not use any type in it, it will not get loaded.

<wz*******@gmai l.comha scritto nel messaggio
news:11******** *************@6 4g2000cwx.googl egroups.com...
Back in COM time, it's possible to use #import statement in cpp to
load COM object type info and use it at coding time. When the
application is started, the underlying COM DLL will not be loaded
until that part of code is called.

Is there a similar thing in .Net (C#) application ?

When I create C# application, I need to add reference to another
assembly if I want to use its classes (I don't want to use reflection
here). But this will also add dependency on that assembly. The
assembly will be loaded when my application starts. Is there a way to
delay the loading of dependent assemblies only when the code using it
is called?

T.I.A.

Mar 6 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
4473
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the "Let Users Add Functionality to Your .NET Applications with Macros and Plug-Ins" article at MSDN for the dynamic loading of DLLs http://msdn.microsoft.com/msdnmag/issues/03/10/Plug-Ins/default.aspx
2
1599
by: Guru Prasad | last post by:
Is there a delay involved in unloading assemblies once a virtual directory is "deleted" using IIS Manager ? At times even after the virtual directory is removed i cannot delete the backing physical directory and it looks like ASPNET runtime is holding on to the assemblies. Once i recycle the ASPNET process, i can delete this directory. Has this got anything to do with strong-named/signed assemblies ( even though deployed as private...
3
1473
by: Nospam | last post by:
I'm trouble shooting my obfuscated program. I'd like suggestions on some tools to help. I'm using vs2005 with delayed signing option from the project settings and reading the hash from a key.snk file. I sn -Vr to register it to ignore strong name verification and everything is fine. I obfuscate and then sn -Vu to unregister it before finally sn -R to resign the assembly. I have runtime problems that can't find the obfuscated...
0
1596
by: Ashok Mistry | last post by:
Hi all, I have a problem in loading Assembly dynamically through the Reflection. I want to Load an assembly, say, Main.dll. The Main.dll is dependent on a DLL, say Abc.dll, which is placed in another known directory. \AppRoot\Main.dll \AppRoot\AGroupOfDLLs\Abc.dll
6
6870
by: Dan Dorey | last post by:
I actually have two questions here, but I'll start by giving an outline of what I'm trying to do. I'm building an app with a simple plugin architecture (all in the same app domain). I have each plugin in a separate sub-dir inside a "Plugins" directory. Each plugin consists of at least two DLLs (a controller and a driver). However, most drivers also rely on other external DLLs. In one particular case this dependency is to a C++ DLL...
0
2311
by: npthomson | last post by:
Hi all, This could get a bit complicated but I'll try to be as clear as possible. I've written an application that discovers plugins at runtime using reflection from a subdirectory of the application, eg: In the directory the application is installed to: \application.exe \plugins\plugin1.dll
2
3420
by: wzhao2000 | last post by:
Back in COM time, it's possible to use #import statement in cpp to load COM object type info and use it at coding time. When the application is started, the underlying COM DLL will not be loaded until that part of code is called. Is there a similar thing in .Net (C#) application ? When I create C# application, I need to add reference to another assembly if I want to use its classes (I don't want to use reflection here). But this will...
1
2233
by: =?Windows-1252?Q?Tor_B=E5dshaug?= | last post by:
BlankHi, I am having trouble loading assemblies from the database in my ASP.NET app. I have a default.aspx in my app that is served from a database via a custom virtual path provider. This works fine, until this default.aspx uses code in a dependent assembly (say CustomAssembly). Then ASP.NET cannot find the class "CustomAssembly.MyClass" and files to compile the default.aspx. I've tried to do a AppDomain.CurrentDomain.Load(byte...
8
3121
by: =?Utf-8?B?TWFyaw==?= | last post by:
We've got a wierd failure happening on just one machine. One part of our product uses a 3rd party search implementation (dtSearch). DtSearch has a native core (dten600.dll), late-bound, and a managed wrapper (dtSearchNetApi2.dll). For reasons unknown our build and msi packaging process includes dtSearchNetApi2.dll but not dten600.dll in all packages, as well as a couple of assemblies that reference it, even though they are not used by...
0
7962
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7884
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8258
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5844
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5423
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3880
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3921
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.