Hi Peter,

AppDomain is intitalized before your project's first line is executed, that
is before Application.Run(Form) statement of Program.cs. So you can even
bind your method to said event handler before that, i.e. you can place it as
very first line of main() function.

I dont think any assembly would require to be loaded before the statement
Application.Run(Form). So your problem should be resolved.

Regards,
Mahesh Savani
On Fri, May 1, 2009 at 6:41 PM, Peter Laman <[email protected]> wrote:

>
> Where should I do this? The exception for the load failure already
> occurs before my first line of code is executed, so how can I handle
> this event?
>
> Peter
>
> On Apr 29, 6:16 am, Savani Mahesh <[email protected]> wrote:
> > Hi,
> >
> > Use AssemblyResolve event of Application Domain. This event is raised
> when
> > CLR founds a reference to an assembly, tries to find that assembly and
> fails
> > to get that assembly. In this event, you can load that assembly yourself
> and
> > give it to CLR.
> >
> > You can use event in this way (C#).
> > AppDomain.CurrentDomain.AssemblyResolve
> >
> > Regards,
> > Mahesh Savani
> >
>  > On Tue, Apr 28, 2009 at 2:15 PM, Peter Laman <[email protected]>
> wrote:
> >
> > > I created a Windows service with C#, which is to be part of a larger
> > > product. It uses a few assemblies created by a different team, that
> > > are located within the folder structure of the the product. The
> > > installer for the product sets up a folder structure with fixed
> > > relative paths, so I want to specify the location of the referenced
> > > assemblies using a relative path (like "..\..\lib\sdk.dll").
> >
> > > Can anybody tell me how to do that? I don't want to add code to load
> > > the assemblies at runtime, for development I just want to specify them
> > > under the 'references' in my VS solution. The only thing I want to
> > > tell the CLR is explicitly where to look for the assembly and I want
> > > to do JUST THAT at runtime.
> >
> > > Thanks for any help.
> >
> > > Peter
>

Reply via email to