• Advertisement
Sign in to follow this  

Where to put dependencies?

Recommended Posts

    Hi, I'm writing a program in C#, and I realize that there are .NET runtime files and potentially other DLL files or the like, which my program may use.

    So I got one of those programs that can tell me what all the dependencies are (all the files that my program is using).  I haven't tried it yet, but it doesn't seem like it should be hard to use.

    But my question is if I want to distribute my program, where should I put these files?  Should I just include them in the same folder with the EXE, or is there somewhere that I need to reference them to specify where they are?

Share this post


Link to post
Share on other sites
Advertisement

You should first review the legal entanglements that come with each dependency; in some cases you are not permitted to directly distribute the DLLs or otherwise, but must ship a redistributable installer.

If you aren't so encumbered, you can usually just .zip everything together in the simplest case, so that when an end-user unzips the archive they get a folder with your .exe + all dependencies they can run. 

If you do have distribution requirements, you may need to build an installer. This is likely the better option, but it involves more work.

Share this post


Link to post
Share on other sites

The way it must be for me is that when I put the files on the removable storage device, they MUST be in the final position as they will be used, so I can't zip anything or make an installer or anything like that.  I'm just wondering how I should position all the files - do they need to be in a specific directory relative to the EXE?

 

And no, legal issues won't be a problem in this case.

Share this post


Link to post
Share on other sites

    That's good to know, thanks.  But what about other dependencies, like COM, ActiveX, OLE, etc. or whatever .NET may have of its own variety?  Do they all work the same way as DLLs?

    In other words, if I just take every file that the dependency checking program tells me I need, and copy them all right into the same folder with the EXE, will that guarantee that there won't be anything missing or unable to be located?

Share this post


Link to post
Share on other sites

But what about other dependencies, like COM, ActiveX, OLE, etc. or whatever .NET may have of its own variety?  Do they all work the same way as DLLs?

 

 

 

Parts of them might, but most of them are more than simple DLLs. You also can't distribute most of those directly, legally. They require redistributables, or that you're using a new enough version of Windows such that the dependency is part of Windows.

 

In other words, if I just take every file that the dependency checking program tells me I need, and copy them all right into the same folder with the EXE, will that guarantee that there won't be anything missing or unable to be located?

 

Nope. Tools like that (depends.exe and such) only look for a specific kind of dependency (basically, DLLs and PE references). A program can contain other dependencies, and it's dependencies can further contain such dependencies, that aren't DLLs. For example, some library may assume the presence of a particular tool known to be available if certain versions of .NET are available (msbuild.exe). depends.exe won't capsure that. 

Edited by Josh Petrie

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Advertisement