473,240 Members | 1,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,240 software developers and data experts.

How to package references into DLL?

If I create a DLL (my.dll) that references other DLLs, how do I make
sure other developers only need my.dll and not all of the other DLLs it
references? Is there a way to compile the references into my.dll and
just distribute one DLL?

Thanks,
Brett

Dec 5 '05 #1
11 6943
Brett Romero <ac*****@cygen.com> wrote:
If I create a DLL (my.dll) that references other DLLs, how do I make
sure other developers only need my.dll and not all of the other DLLs it
references? Is there a way to compile the references into my.dll and
just distribute one DLL?


Well, there's ILMerge, but that's a bit of a hack - it's not how things
were meant to work.

You *should* distribute the separate DLLs. That way, if there's a patch
available for a particular DLL, that patch can be applied without
affecting anything etc. It also keeps it clear where things came from.

Do you have any particular reason for not wanting to ship the other
DLLs separately?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 5 '05 #2
No. I just wasn't aware of the missing references in this case.

The recipient will have problems then if the distributor does not
provide everything? Is there a way for the recipient to know ahead of
time if DLLs are missing? Meaning, before they spend time compiling
and getting errors.

Thanks,
Brett

Dec 5 '05 #3
Brett Romero <ac*****@cygen.com> wrote:
No. I just wasn't aware of the missing references in this case.

The recipient will have problems then if the distributor does not
provide everything? Is there a way for the recipient to know ahead of
time if DLLs are missing? Meaning, before they spend time compiling
and getting errors.


Well, you could fairly easily write a dependency walking app to make
sure that everything's there - but a manual "these are the files you
need" file list is probably a more straightforward solution :)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 5 '05 #4
Here's a scenario, I include the new DLL in my app. It compiles fine.
Then I hit this line of code:
Config.GetAppSetting()

and get this error:

An unhandled exception of type 'System.IO.FileNotFoundException'
occurred in core.test.dll

Additional information: File or assembly name log4net, or one of its
dependencies, was not found.

I put the log4net.dll in my bin folder and everything is fine. I can't
find any place that log4net is referenced in core.test.dll or my app.
How is Config.GetAppSetting() able to do anything when there is no
"using" statement or reference to its library?

If I do a go to definition, I get a cannot navigate error. If I do a
go to reference, I get a symbol has no reference error. I don't
understand how this code is linked to the library or how it is
referencing it. Any ideas?

Thanks,
Brett

Dec 6 '05 #5

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
Brett Romero <ac*****@cygen.com> wrote:
No. I just wasn't aware of the missing references in this case.

The recipient will have problems then if the distributor does not
provide everything? Is there a way for the recipient to know ahead of
time if DLLs are missing? Meaning, before they spend time compiling
and getting errors.


Well, you could fairly easily write a dependency walking app to make
sure that everything's there - but a manual "these are the files you
need" file list is probably a more straightforward solution :)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too


In reference to the first question, all of those DLLs don't have to go with
the main DLL. After putting the log4net.dll into the bin folder, I was able
to remove all the other DLLs used to build my.DLL. How is my.DLL able to be
distributed without its references?

Thanks,
Brett
Dec 6 '05 #6
Brett Romero <no@spam.net> wrote:
In reference to the first question, all of those DLLs don't have to go with
the main DLL. After putting the log4net.dll into the bin folder, I was able
to remove all the other DLLs used to build my.DLL. How is my.DLL able to be
distributed without its references?


It can't be, if it actually uses those references. If it's trying to
call into Log4Net code, it makes sense that you've got have Log4Net on
the system in order to get it to work.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 6 '05 #7
Brett Romero <ac*****@cygen.com> wrote:
Here's a scenario, I include the new DLL in my app. It compiles fine.
Then I hit this line of code:
Config.GetAppSetting()

and get this error:

An unhandled exception of type 'System.IO.FileNotFoundException'
occurred in core.test.dll

Additional information: File or assembly name log4net, or one of its
dependencies, was not found.

I put the log4net.dll in my bin folder and everything is fine. I can't
find any place that log4net is referenced in core.test.dll or my app.
Well, I would suggest that it's there somewhere. Open up the DLL in
reflector and look at the referenced assemblies there.
How is Config.GetAppSetting() able to do anything when there is no
"using" statement or reference to its library?


It's hard to know without seeing the code.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 6 '05 #8
Well, I removed all of the DLLs from my project that are referenced in
main.dll. I also deleted these DLLs from my project bin. The only DLL
I'm referencing in main.dll. This means, although main.dll referenced
other DLLs during its compiling, they don't have to be distributed with
main.dll.

Why is that? I know you disagree but that's just the empirical facts
of the situation. I'm still confused as to whether a DLL I create,
which references other DLLs in its project, must be distributed with
all of its references. According to the above scenario, the answer is
no.

Thanks,
Brett

Dec 6 '05 #9
I did open main.dll in reflector. In the references, log4net is no
where to be found. Yet, I can't use main.dll unless log4net is in my
project's bin folder with main.dll.

Dec 6 '05 #10
Brett Romero <ac*****@cygen.com> wrote:
Well, I removed all of the DLLs from my project that are referenced in
main.dll. I also deleted these DLLs from my project bin. The only DLL
I'm referencing in main.dll. This means, although main.dll referenced
other DLLs during its compiling, they don't have to be distributed with
main.dll.

Why is that? I know you disagree but that's just the empirical facts
of the situation. I'm still confused as to whether a DLL I create,
which references other DLLs in its project, must be distributed with
all of its references. According to the above scenario, the answer is
no.


If one assembly references another, then if any of the code it executes
tries to load a type from that second assembly, then yes, the assembly
must be present.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 6 '05 #11
Brett Romero <ac*****@cygen.com> wrote:
Well, I removed all of the DLLs from my project that are referenced in
main.dll. I also deleted these DLLs from my project bin. The only DLL
I'm referencing in main.dll. This means, although main.dll referenced
other DLLs during its compiling, they don't have to be distributed with
main.dll.

Why is that? I know you disagree but that's just the empirical facts
of the situation. I'm still confused as to whether a DLL I create,
which references other DLLs in its project, must be distributed with
all of its references. According to the above scenario, the answer is
no.


Just as a thought - does your configuration file mention log4net
anywhere? Maybe a config setting is trying to load it reflectively...

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 6 '05 #12

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

Similar topics

4
by: Gerry Laenen | last post by:
Hi, I first created several ActiveX DLL's which interact with each other, an SQL Server database, ... Some Active DLL's use different references: i.e. one that does not interact with a database,...
6
by: Logan | last post by:
Would you recommend to use the wx package of wxPython? From the documentation: Provides a way to drop the wx prefix from wxPython objects by dynamically loading and renaming objects from the...
1
by: RWC | last post by:
Hello, I'm getting an odd error in my Package and deployment wizard that seems to have cropped up for no good reason. The erros is as follows; Error -2147221163 Method '~' of Object '~'...
2
by: kkrizl | last post by:
I have an Access database that has a few huge tables. It was taking about 20 minutes per table to import them from another application. I used the upsize wizard to put them in a SQL server...
1
by: Chris | last post by:
Hi, Is it normal for dependencies found by a setup project to be included in the MSI even if they are references to DLL's in the GAC? I have several references in a project that are to GAC...
11
by: fortepianissimo | last post by:
Say I have the following package organization in a system I'm developing: A |----B |----C |----D I have a module, say 'foo', that both package D and B require. What is the best practice in...
1
by: marcroy.olsen | last post by:
Hi Python list, I have been struggleling with this before, but have never been able to find a good solution. The thing I dont understand is, I follow the guide here:...
3
blazedaces
by: blazedaces | last post by:
Hello, it's been a while since I posted on these forums. My issue I think isn't as much in my code as it's in the syntax and structure in references other packages. I'll get straight to it then: ...
3
ChrisWang
by: ChrisWang | last post by:
Hi all, I have a simple question about "Intra-package References" There are two source files and __init__.py in package MyPkg shown below: |-MyPkg -__init__.py -example.py -test.py
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.