Click here to Skip to main content
12,622,741 members (27,634 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: Embedded C# Windows DLL
I have two projects in the same solution. Project A needs to refer to Project B.

In Project A debug folder, there is a dll file generated from Project B.

Project A.exe runs fine if it is in the same fold as this dll file, but it will get an error massage, “Unhandled exception……Could not load file or assembly……”, if I move Project A.exe to another location without moving this dll file together.

Questions: is there a way to “embed” (I am not sure about this term) Project B dll file into Project A.exe, so I don’t need to keep them together all the time?

Thanks for your answer or hint:)
Posted 5-Jun-13 6:27am
Comments
   
First of all, you should understand that EXEs and DLLs are not essential to .NET. There are modules and assemblies.
—SA
fishcosine 8-Jun-13 23:36pm
   
Thank you both for the answers!!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
CHill60 5-Jun-13 11:39am
   
I like that! My +5
ProgramFOX 5-Jun-13 11:42am
   
Thank you!
   
Right idea, a 5.
(I'm not sure if OP really needs it, but that's certainly a solution.)
—SA
ProgramFOX 5-Jun-13 11:51am
   
Thank you!
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

Instead of "moving" an exe around create a deployment package that contains all the dependent stuff you need (this might include config files and other resources for example).

Here's a starting point on deployment topics[^]
Another one to watch out for is on the properties for references like this ensure that Copy Local = True is set
  Permalink  
Comments
ProgramFOX 5-Jun-13 11:43am
   
Deployment is a good idea, my 5!
CHill60 5-Jun-13 11:48am
   
Thank you! Folks are going to think we're each other's sock puppet if we keep this up ;-p
ProgramFOX 5-Jun-13 11:50am
   
:laugh:
   
Yes, the point is: maybe OP does not really need to merge the assemblies to have a single module. My 5 suggesting to consider the alternative.
The problem of merging can be resolved according to Solution 1.
—SA
fishcosine 8-Jun-13 23:37pm
   
Thank you both for the answers!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.161128.1 | Last Updated 5 Jun 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100