Sameet
Sameet

Reputation: 2211

Can I modify the content of an embedded resource (text/xml file) in a .NET application

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?

Upvotes: 3

Views: 4884

Answers (2)

Jon Skeet
Jon Skeet

Reputation: 1503290

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

Upvotes: 3

Nader Shirazie
Nader Shirazie

Reputation: 10776

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?

Upvotes: 4

Related Questions