views:

1032

answers:

2

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?

+3  A: 

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?

Nader Shirazie
trying to achieve a simple thing...1. make a user specific xml file, which is used to store large amount of data ... 2. use click-once deployment (this means I can't place those files in a special folder during setup)
SaM
when is the user specific xml file generated?
Nader Shirazie
could be generated on first run...
SaM
going to use LocalAppData...
SaM
Yes, I was going to say -- use LocalAppData or IsolatedStorage to keep track of the user file, which you generate on first run. If you are using some template for the xml file, then *that* can be stored as a resource. Otherwise, if you're just serializing some large object that you construct from scratch, then you don't need it as a resource at all...
Nader Shirazie
+2  A: 

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).

Jon Skeet