C
C#•2mo ago
TilionDC

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
Buddy
Buddy•2mo ago
Why do you want this?
TilionDC
TilionDC•2mo ago
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
Buddy
Buddy•2mo ago
Just use a config file, which is far easier than implementing self-rewrite Json is simple enough
TilionDC
TilionDC•2mo ago
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 🙂
kurumi
kurumi•2mo ago
Roslyn? :when:
TilionDC
TilionDC•2mo ago
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?