Application rewrite itself during runtime?
My question is, is it possible? I have tried looking using filestreamoptions.share but it doesn't allow writing to a program that is used, only reading. My only idea so far is for the application to start a new application, close itself and then have the second application edit the file and then open it again. However I would like the have the file keep its PID.
6 Replies
Why do you want this?
So I have some scipts that I run in python but i hate python so I wanna rewrite them in c# the thing is that I don't want to recompile every time that I need to change something and I don't want a seperate settings file so I thought to append the settingsfile to the end of the executable. I got everythign working for it to write a copy with the settings appended. I just need a good way to have the application apply it to itself instead of creating a copy
Just use a config file, which is far easier than implementing self-rewrite
Json is simple enough
Thats not my question. My hobby is writing weird code like this. I just need to know if anyone have a better idea than the one i presented.
But thanks for trying 🙂
Roslyn? :when:
But how would that work? Do you mean like every time it runs, it will compile and runtime compiled copy of the program? Or did you have a neater idea?