473,396 Members | 1,861 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,396 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 6947
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.