user728584
user728584

Reputation: 2135

Editing a C# resource file of a compiled assembly

I have a resource file where I am storing connection string etc for a class library (I cant use an App.config, don't ask why). It was my assumption (might be a stupid one) that I would be able to modify the .rex file out side of the complied assembly at runtime to be able to change connection string through environments without recompiling the assembly each time, can someone verify my assumption and if possible tell me how to do it?

Cheers

Upvotes: 5

Views: 7827

Answers (2)

Marcel
Marcel

Reputation: 15742

If it's a text resource, you may try to just replace the characters.

I have successfully modified a SQL query which was included in .EXE assembly with Notepad++. I made sure though, that the number of characters was not altered.

Upvotes: 1

Alex Aza
Alex Aza

Reputation: 78507

You can disassemble assembly, edit resources and assemble it again.

You can find some info here.

Upvotes: 2

Related Questions