I've written a command-line tool in C# which swaps out a resource in a .resources file for an alternative one. It uses ResourceReader and ResourceWriter.
I'd like to do the same thing for dll files, but I can't find a way of doing this. I tried using Reflection, but that only works on DLLs which are .net (managed) ones. Most of the dlls I'm using are built with other things.
I can't for the life of me figure out how to do this! Things like Resource Hacker do it, so it must be possible.
Can anyone help, please?
Thanks
A really good step-by-step guide can be found here: How to load unmanaged (native) resources from managed C# code
Related
I've decided to use RoundhousE for my database. Now there are three ways to use this tool. With MSBuild, a DLL File or the console application. I found some documentations how to use the MSBuild variant and I know how to use the console application but I can not find anything how to use the DLL in Visual Studio and how to call/configure RoundhousE this way.
Does someone know where to find a detailled documentation or could someone explain me this?
The DLL is used in a few places, like with DropkicK - it may not be a bad idea to explore how it uses it, as there is not much documentation with this otherwise. You can also review how Roundhouse RefreshDatabase uses it as well.
DropkicK - https://github.com/chucknorris/dropkick/blob/master/product/dropkick/Tasks/RoundhousE/RoundhousEClientApi.cs
RoundhousE-EntityFramework RefreshDatabase - https://github.com/chucknorris/roundhouse-entityframework
HTH
I have a C# dll that has some embedded resources and i'm having troubles with a couple of them. What would be the best app's to pull these resources out so that I can check them over?
Try DotNetResourcesExtract
UPDATE:
Seems like doesn't work with .Net 3.5 files.
Try Resource Tuner. Looks promising and it has a 30 day fully functional trial version available for download.
I found that opening the file with .Net Reflector allowed me to see the Resources!
I will appreciate your help in this. I have spent many time in looking for a procedure or tool that can let me create a single DLL from other private dlls (I named private because these dlls are working under licensing). I already bought the lic but I dont like to see the vendors name in my apps (I'd prefer to see the dlls as MyDll.dll rather than Microsoft.dll)
I have used the Gilma and the ILMerger tool that Microsoft has in its website without results. So do you guys know how to create this dll?
Thanks,
Mark
Tools like ILMerge will merge managed assemblies. However, you may have problems doing this with 3rd party dlls as they will most likely be code-signed with a certificate and obfuscated to stop people tampering with them in any way.
Another approach would be to embed the 3rd party dlls as file Resources. You can then load them with Assembly.Load using a Stream created directly from your resources (GetManifestResourceStream), so the user will never see them as separate files on disk, but you won't actually be attempting to change their contents.
I have a DLL (Test.dll) which contains some Excel Addin, i don't know which version this is build with (might be with VB6, but i am not sure).
When i tried referencing this DLL in the VS2008 i get the message
A reference to the <DLL Name> could not be added. Please make sure that the file is accrssible, and that it is a valid assembly or COM Component.
If anyone could please help me in this, it will be great.
Any help is appreciated.
Thanks and Regards,
Tushar
It seems to me the DLL you're trying to load isn't a managed DLL, or one that the CLR can treat as managed.
One solution would be to use managed C++ (C++/CLI) to build a wrapper around the DLL. Another is to use PInvoke which is explained here and there's a tool for it I came across here.
You can also look in this thread: Unable to Use DLL of VB6 Into ASP.NET.
Hope one these work out for you,
Asaf
I'm writing a C# wrapper for a third-party native library, which we have as a DLL. I would like to be able to distribute a single DLL for the new assembly. Is it possible for me to embed the win32 DLL in my .NET DLL, and still make calls into it using P/Invoke? If so, how?
I've never done it but I know of an opensource project that does this. They embed the native SQLite3 code into the managed SQLite assembly using their own tool called mergebin.
Go and take a look at the SQLite project for .NET by PHX and grab the source and you can see how it's done.
Should work, if the native dll does not have any dependencies.
You can compile the dll in as embedded resource, than access the stream from inside your code, serialize it to the temporary folder and use it from there.
Too much to post example code here, but the way is not to complicated.
I don't think you can do it directly, but it's possible to extract it at runtime to some temporary location and make call to that copy.