Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
1.80/5 (2 votes)
how to integrate dll's such as (Interop.JRO.dll) etc in the software exe. i am using windows form c#. Thanks in advance.
Posted
Comments
BillWoodruff 6-Dec-13 8:03am    
Please read the QA Guidelines and do not post your question on more than one forum.
agent_kruger 6-Dec-13 8:19am    
sorry but i just posted on 1 forum.

I'm guessing you want to distribut eyour application as single .exe and load all dlls from embedded resource.

If that's the case you need to:
1) add dll to the project (Project/Add Existing Item..)
2) change added dll properties:
• BuildAction = embedded Resource
• Copy To Output Directory = Do not copy

Then in your code you need to code AppDomain.CurrentDomain.AssemblyResolve event handler (this will be called whenever assembly needs to be loaded).
In the handler you need to load assembly from resources:

C#
var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourcename);
byte[] assemblyData = stream.Read(assemblyData, 0, assemblyData.Length);
return Assembly.Load(assemblyData).
 
Share this answer
 
v4
Comments
agent_kruger 7-Dec-13 0:05am    
yes i have already tried embedded resources but interop.Excel does not get embedded i dont know why?
while you are coding add referece of the dll to you code and then prepare the build.
 
Share this answer
 
Comments
agent_kruger 6-Dec-13 7:42am    
i have already added it in ref. but instead of a single exe it gives me dll to in the debug folder.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900