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!
Related
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
we have an application in production and the code is in Pre-Compiled form. The developer who developed that application left the company and we don't have any backup of source code. the only access we have is Pre Compiled code in the server. We need to fix the issues in the application now.
Is there any way to Decompile (extract to actual source code) the PreCompiled code ?
Open the DLLs in the .NET Reflector.
To update #xOn's answer:
Due to a recent source control disaster I had to recover my project from the DLLs. So sadly I'm knowledgable on the procedure:
Get .Net Reflector from here: http://www.red-gate.com/products/dotnet-development/reflector/
You do not seem to need FileDisassembler.
Either load your bins in Reflector or double click them.
Mind that the .Net framework might have not maintained your original project file structure. So if some of your ASPX pages shared the same basic class name in different .cs files (I.E. Inherits tag is the same, but CodeFile tag differs), you would not be able to simply "export source code".
Don't go blindly exporting source files. It won't work.
There will still be some work to be done before being able to just fire up the old build button. For example - DLLs can refer to property's getter/setters directly. You will have to fix that.
Good luck.
Start with:
http://www.red-gate.com/products/dotnet-development/reflector/
...plus:
http://www.denisbauer.com/NETTools/FileDisassembler.aspx
You'll have to recompile the latter to link it against v6.5 of reflector (the latest, as of this post.) It is a good add-on if you want to avoid having to copy and paste ever single class into files by hand. It will dump an entirely assembly as .cs files. I think it may even generate a csproj.
Both tools are free.
I had the similar issue and used Reflector to Decompile it. I got the source code, then changed the bit I wanted, and rebuild it. Then I copied that dll again to Production site. It started to reflect my changes. It was very easy and not at all difficult, maybe because Precompiled site had dlls for every page, and was updatable , so had only code-behind file in dll.
For reference: http://www.reflector.net/
When u install .net reflecter.its import in visual studio.
then you saw the .net reflector tools on menu bar.
Click on .net reflector >>Choose Asseblies (Dll file) to debug.
I found that dll can be just Read using the .NET Reflector tool but can't extract the Source Code. And also once the webforms are precompiled, we can't even get back the code behind files. All we can do is to debug and analyze the Code.
I have an application that makes use of/consumes services from a number of external .net libraries, which in turn calls certain executables. Would it be possible to integrate these into one huge executable and load them from my application to the disk as required? Resources come to mind but not sure how that is done.
Thanks,
You have several options to do that:
use ILMerge (free)
For howto see here and here
OR
use some tool like SmartAssembly (commercial)
it can embed and merge among other things (no need to change your source code)
OR
code that yourself in less than 10 lines (free but minimal source code change)
mark all needed dependencies as "embedded resource" - this way they are included in the EXE file... you need to setup an AssemblyResolve handler which at runtime reads from Resources and returns the needed DLLs to the .NET runtime...
You can use ILMerge to merge all your assemblies into a single executable file.
You can find a complete example at CodeProject.
There is a similar question for 3.5 here:
Is there a built-in zip library in .NET 3.5?
that speculated that 4.0 would have it, but I can't find any info about it. If not, does anyone know why not? Seems like it would be fairly high on the list of things to include support for.
Take a look at the System.IO.Packaging namespace, which contains support for ZIP files, but not all of the features of ZIP files.
Still, it might be enough for your needs.
You may have already moved along, but ZiP API is added in .NET 4.5
http://msdn.microsoft.com/en-us/library/system.io.compression.ziparchive.aspx
go nuts.
Not for 4.0, but a ZipArchive class is being considered for the next version. You can find details about this on the BCL Team blog.
Edit: Otherwise, assuming that it's still available, and depending on your definition of built in (at least it comes/came with Visual Studio), you might be able to use the J# classes to zip files as described in this article: Using the Zip Classes in the J# Class Libraries to Compress Files and Data with C#
Edit2: Though note the comments below, that the J# option is probably not the right option except in certain unusual circumstances.
Most easiest to deal with, is with sample code here.
You need to add a new assembly just to find he Zip archive.
Working with Zip files in .NET 4.5
I had a problem I lost all my source(CS) of web site pages but I had only published pages on server ,so please if there is any way to recover theses published pages to orignal pages with code,bin folder
You need to decompile the C#. It is an advanced user scenario, but it can be done... sort of.
How do I decompile a .NET EXE into readable C# source code?
try to use reflector. it help you to restore all your code
Use your latest backup copy, or roll back to the previous version of SVN you are working on.
http://www.red-gate.com/products/dotnet-development/reflector/ is a good piece of software for recovering source from a compiled program.
If your project was a website, you should be able to ftp each file from the server 1 for 1. If your file was a web application project, you're hosed. The code files are compiled into a binary, and if you lost the source code it's gone.
http://www.red-gate.com/products/dotnet-development/reflector/ Can decompile .NET assemblies into source code - however it won't be the code you wrote as alot of it will have been changed by the compiler (IE your comments will have gone bye bye)
You can then rebuild your Project in your IDE of choice and you are done.
If the assemblies haven't been obfuscated, you can use reflector to recover your code from the assemblies.