I am working on a Dot Net project and I am using C++ .dll files. I want the output of the program as just a single .exe file(which can easily be given to the customer) rather than multiple files. I have added those files under Properties>> Resources. However, when I tried adding them as Reference, I get the following error: Please make sure that the file is accessible and that is a valid assembly or COM component.
Is there a way to bundle these file into one without using 3rd party tools/extensions?
Plz advise.
Thanks in advance.
Related
We are working on a validation script for Kofax Capture 9.0 / 10.0 in VB.NET 3.5.
We know how to create a script using the Admin Module, and how to get it operational.
The problem is that we need to reference a dll, located on a remote machine. (GAC is no option) This dll holds abstract classes we need in each validation script.
Even when putting the dlls locally (copy local), the Validation Module (index.exe) immediately throws the "cannot find reference" exception, even though the project compiled perfectly.
I guess the basic question comes down to: where do we put the dlls, in order for the Validation Module to find them?
The simple answer is to put the dll in the same folder as the application because this is one of the places which .NET will probe when trying to find it. The Validation module is run from the Capture bin directory which will be something like "C:\Program Files (x86)\Kofax\CaptureSS\ServLib\Bin\". This would need to be done on each client using Validation.
If you have a more complicated scenario, you could look implementing the AppDomain.AssemblyResolve Event and using Assembly.LoadFile to get the assembly from a custom location, but the using the bin path is less complicated.
If you end up having further trouble, you can troubleshoot by using the Assembly Binding Log Viewer (Fuslogvw.exe) which can tell you more details about why the assembly failed to load and where .NET tried to search for it. Assembly loading can fail for reasons other than just the path.
For more detail on how .NET loads assemblies, see the following:
How the Runtime Locates Assemblies
Locating the Assembly through Codebases or Probing
We found a solution: add all library files as "links" to the project. (Add --> Existing File --> small arrow next to "Add" --> Add as Link)
This ensures the files are compiled when you build the project. The Kofax Validation Module can now find the files, whereas when referencing the file, it could not. Why it could not, remains a mystery...
So I'm trying to recreate and implement a section of code from a JavaScript file. I need to be able to use "Zlib.Deflate.compress" or something equivalent that will get me the exact same results.
I downloaded Zlib which included the .dll, 2 header files and a .lib file. but i cant figure out how to implement this into my application. I've tried to add it as a resource but i keep getting an error "A reference could not be added. Please make sure this file is accessible, and its a valid assembly or COM Component"
I tried using the method on http://msdn.microsoft.com/en-us/library/ms235636(v=vs.80).aspx to create a .dll file out of the header and .lib files, but that gave me a build error as well.
I don't know where to go from here.
Just use the native .NET DeflateStream class it should do exactly what you're looking for and doesn't require any third party libraries. Just the framework itself.
I am trying to compile a project with MinGW that uses the fltk library. Whenever it gets to the file using fltk, it tells me "cannot find -lfltk".
I know it comes down to getting the .dll for the library and where I put it, but I am having a lot of trouble figuring this out. I found two files in the fltk folder named fltk.lib.dsp and fltkdll.dsp. I tried to just put these files in my system32 folder, but that did not work. I'm guessing thats because these are both VC++ 6 project files and not actually .dll and .lib files. I found this article:
http://www.fltk.org/articles.php?L372+I0+TFAQ+P1+Q
but I don't understand what it is saying.
you will need to define the FL_DLL preprocessor symbol to get the correct linkage commands embedded within the FLTK header files.
What does that mean? Do I need to #define something before my includes? How does this sentence translate into code?
If I am not on the right track please tell me. Any help is appreciated.
edit:
Also, I have my PATH variable set to C:\MinGW/bin/. I tried setting the files in there, but that did not work either. I know I have to do something to these .dsp files, but don't know what.
the error message is not related to dll.
it actually says that the linker library named 'libfltk.a' is not found.
so you should have that library first for compiling your program.
I have two use cases: 1) loading a temporary DLL during a custom action and 2) executing a temporary EXE from a custom action. The custom action DLL is unmanaged C++. I cannot figure out how to get this working correctly. Including the DLL is easy enough but LoadLibrary is failing as it cannot find the DLL. I also cannot seem to get the physical path of the extracted DLL in order to specify full path in LoadLibrary. Any help is appreciated. I'm using WIX btw for this work.
If you have included the dll and the exe in the Binary Table of the msi, the files will be physically present in the %Temp% folder of the currently logged in user which gets mapped to SUPPORTDIR property of Windows Installer.
You need to use MsiGetProperty to get the SUPPORTDIR and use that in the LoadLibrary.
One thing to remember - Windows Installer usually extracts files from Binary table to %TEMP%, however - the current work directory is often set to c:\windows\installer.
My suggestion - extract the temporary .dll from Binary table yourself when you need it. This gives you the control of when it's saved to. Just remember that you need write permission to the location, so usually some subdir of %temp% is the best choice.
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?
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.
in the properties for the reference set the Copy To Output to Always
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.