Re-Embedding Sqlite Database file into the same Executable

后端 未结 2 1082
醉梦人生
醉梦人生 2021-01-23 10:05

I\'m Creating Win Form application ,I\'m adding a Empty Sqlite Database file having Tables in it as embedded data source. on run time i extract Database file into application pa

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-23 10:48

    I'm not sure if I understand the question correctly. If you are trying to re-write to the same exe you are running this is NOT possible. Windows locks code files that are in use so that they can't change. Additionally, it is not advisable either, code and data should be separate.

    If you are trying to update another resources executable (that is not currently running), I don't know how to do that programatically (See this thread here for more info How do I replace embedded resources in a .NET assembly programmatically?) but if your program has access to the Visual Studio Compiler tools (which it probably doesn't) you can disassemble and reassemble the executable. See here: http://fortheloveofcode.wordpress.com/2007/09/24/change-resources-inside-assembly/.

提交回复
热议问题