[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to define the path to an assembly DLL in the applicationConfig.xml

Posted on 2008-06-12
8
Medium Priority
?
407 Views
Last Modified: 2010-04-21
I'm working with some software where I can extend the functionality by adding libraries to it.
In order to add the new stuff, I create a library and point to it in an ApplicationConfig.xml that resides in the directory of the executable.

The new DLL can be put either in the GAC (which I have to avoid) or in the directory of the executable, then it works fine. I would like to put my custom assemblies in a separate directory so I need to add the path somehow.

This is the definition I currently have that works with the MyTest.DLL in the GAC or in the directory of the EXE.
<Assembly name="MyTest, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
      <Module class="My.Namespace.Class.MyTest">
      </Module>
  </Assembly>

The assembly is: MyTest.dll
The class included in this one is: My.Namespace.Class.MyTest

CAVEAT: I'm not sure if this is .NET standard or something custom for this particular application.
If it's not standard, I have to try to get the info from the vendor but I suspect a response might take a while so I try here first.
0
Comment
Question by:Sharp2b
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 21766939
u can hook assembly resolve event of appdomain to do this
0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 1500 total points
ID: 21766953
AppDomain.CurrentDomain.AssemblyResolve +=
                new ResolveEventHandler(CurrentDomain_AssemblyResolve);


static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            string AssemblyFullName = args.Name;
            //load from the folder u want as

            Assembly assembly = Assembly.LoadFile(assemblyPath);
            return assembly;
        }
0
 

Author Comment

by:Sharp2b
ID: 21767024
I'm not sure where I could add this code.
My code is not loaded unless the main application can find it as defined in the ApplicationConfig.xml
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 21767119
if winfors then in programs.cs
if WPF app then app.xaml.cs
0
 

Author Comment

by:Sharp2b
ID: 21767158
Thanks, I probably need to clarify the situation.
I'm extending the functionality of an application that is outside of my control. On startup, this application reads the ApplicationConfig.xml to find out what assemblies to load. One of them being my custom code. None of my code is executed unless it's loaded as specified in the xml file.

The problem is to get my code loaded from a specific location that is not the directory of the exe (where ApplicationConfig.xml is also located) or the GAC. So, I need a way to specify the path to the DLL in the xml file. Maybe this is not standard .NET stuff but something that is defined by the vendor of this application. Then I might have to ccontact their developers to find out if this is possible.

Sorry if I was not clear before
0
 
LVL 29

Expert Comment

by:Gautham Janardhan
ID: 21767275
if u dont have acesst to the startup then this soln cant be used..
ApplicationConfig.xml is this deefined by the vendor ?  then u will have to contact them for more info..
0
 

Author Comment

by:Sharp2b
ID: 21767302
I will do so.
Thanks a lot for your help anyway, and I will accept your solution above as I had no idea about this possibility and I think it can come in handy in other projects later on.
0
 

Author Closing Comment

by:Sharp2b
ID: 31466459
Thanks!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question