none
Portable versions of ilDasm and ilAsm RRS feed

  • Question

  • Hi All,

    I want to do a modifications on resources inside a .Net exe files. I have done my researches and found the only way to do the modifications on .Net PE files is to  Reassembly and Assembly exe file.

    My requirement is to do this activity on the client user machine who might not have the DotNet SDK installed on his machine.

    One more thing, I found an library Cecil-Mono but this will work with only PE32 assemblies and not for .Net PE.

    Please advise.

    Monday, December 24, 2012 10:34 AM

Answers

  • "Why it doesn't make sense?"

    Because resources are supposed to contain data that doesn't change. Just like you don't change the code of your application at runtime.

    "This exercise has been done over here"

    The fact that it is possible and some random guy with a blog did it doesn't mean it's also a good idea.

    "Let me give an example, If my application is connecting to a web service on the internet and url changed in future, then my application should update itself with new provided url."

    That's what application settings, configuration, registry etc. are for. Resources are not designed for this.

    "I’m looking to keep my exe file portable as much as I can with no extra configuration files."

    You can always store a default web service url in code or a resource. But if the url does change (by user intervention for example) then you should persist the changed url using one of the means mentioned above, not by changing the executable.

    Sunday, December 30, 2012 11:35 AM
    Moderator

All replies

  • Hi Ahmad,

    Welcome to the MSDN Forum.

    So far, I have not found a clearly way to achieve this goal.

    When you don't install the DotNet Framework, your assembly cannot work on this machine, so why do you want to change the PE file. In addition, all .net PE file are PE32(+) file. There is no PE file.

    Would you like to provide more information, so we can try to provide a workaround?

    Thank you.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.


    Tuesday, December 25, 2012 2:15 AM
    Moderator
  • Hi Mike,
    Thanks for your reply.

    As you know all .net assemblies have different structure from native win32 applications hence I’m looking for a solution to modify .Net resources on fly and couldn’t achieve that.

    So the only solutions which I found is to disassembly .net exe file then do the modifications in resources files and then reassembly it again, in order to do that we need to have .Net SDK installed in machines and in my case I don't want to force customers to install it.

    Note: SDK is a development kits and it’s not require to run .Net applications.

    Tuesday, December 25, 2012 3:53 AM
  • Hi Ahmad,

    >>Note: SDK is a development kits and it’s not require to run .Net applications.

    My bad, and I have changed the word SDK to Framework. Thank you for correcting me.

    Would you mind to tell me what are you going to do after "So the only solutions which I found is to disassembly .net exe file then do the modifications in resources files and then reassembly it again" ?

    Thank you so much.


    Mike Feng
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 25, 2012 4:20 AM
    Moderator
  • Hi Mike,

    Yes, you are correct. The only ways which I found is to disassembly .net exe file then
    do the modifications in resources files and reassembly it again. But this will
    not be applicable when I need to release the application to client as it requires
    .Net SDK.<o:p></o:p>

    Kindly
    advise if there some way to achieve that.<o:p></o:p>

    Sunday, December 30, 2012 4:10 AM
  • It doesn't make sense to modify assembly resources and doing it is asking for trouble. If the data that's contained in resources needs to be modified then don't store it as resources, store it in separate files.
    Sunday, December 30, 2012 8:43 AM
    Moderator
  • Why it doesn't make sense? This exercise has been done over here change resources inside assembly

    I’m looking to keep my exe file portable as much as I can with no extra configuration files.

    Let me give an example, If my application is connecting to a web service on the internet and url changed in future, then my application should update itself with new provided url.

    Sunday, December 30, 2012 11:10 AM
  • "Why it doesn't make sense?"

    Because resources are supposed to contain data that doesn't change. Just like you don't change the code of your application at runtime.

    "This exercise has been done over here"

    The fact that it is possible and some random guy with a blog did it doesn't mean it's also a good idea.

    "Let me give an example, If my application is connecting to a web service on the internet and url changed in future, then my application should update itself with new provided url."

    That's what application settings, configuration, registry etc. are for. Resources are not designed for this.

    "I’m looking to keep my exe file portable as much as I can with no extra configuration files."

    You can always store a default web service url in code or a resource. But if the url does change (by user intervention for example) then you should persist the changed url using one of the means mentioned above, not by changing the executable.

    Sunday, December 30, 2012 11:35 AM
    Moderator