问题
The title is pretty much the question :-)
I've embedded an xml file and a txt file as resources in my .NET app. Am still debugging other things, so cannot run and test this.
So just asking, would I be able to modify these files at runtime, after deployment?
回答1:
Nope. An embedded resource is a set of bytes in the assembly.
Its like trying to modify the code in your assembly, after compiling.
This would be doubly bad if your assembly has been signed.
If you're trying to swap resources in and out, you can move your resources into a separate (satellite) assembly, and swap that assembly at deployment time.
What are you trying to achieve?
回答2:
No, you can't change embedded resources.
You might want to consider copying the resource out to disk on start up, if it doesn't already exist, but using an existing file if it's already there (in which case it may have been modified).
来源:https://stackoverflow.com/questions/1038795/can-i-modify-the-content-of-an-embedded-resource-text-xml-file-in-a-net-appli