views:

45

answers:

3

i did a build in vb.net and got one exe file

however, when a user runs the file, it says it is missing one of the libraries (itextsharp).

so the question is, if there is actually a build option in vb.net, why does it not include the library in the same exe file?

+1  A: 

in the properties for the reference set the Copy To Output to Always

Preet Sangha
+2  A: 

You can distribute the iTextSharp DLL with your application. The easiest way to do this is to simply include it in the same folder as your EXE. The DLL should be output to your Project's Debug/Release folder each time you build assuming you've added it as a Reference in your project and the Reference's 'Copy Local' property is set to True.

If you want to distribute one EXE and include the iTextSharp in that, you can use the ILMerge tool (or alternately Gilma from SourceForge) after you build your EXE.

Jay Riggs
+1  A: 

ITextSharp is not a library linked in your project output; it's an assembly referenced by your project output. And while VB.Net builds one executable from your source code, the CLR still needs all the referenced assemblies in the same folder as your executable.

To make everything work, you can distribute ITextSharp assemblies along with your app. Alternatively, if you indeed need only one file, you can use ILMerge on your project output and the assemblies you want included. However, you might need to determine all the correct assemblies you need merged. I wouldn't revommend using this tool, unless you understand how it works.

Note: If you want to use ILMerge with .Net v4.0, read this page.

Franci Penov