devshorts
devshorts

Reputation: 8872

Update DLL metdata after dll is already built

I'm curious if there is a way to change a managed DLL's metdata (such as product name) after it has already been compiled. I know in this question: Change Assembly Version in a compiled .NET assembly, they mention to use ILMerge to update the version number by merging the IL into a clone of itself, but when looking at the ILMerge command line flags I don't think ILMerge supports other properties.

The reason I'd like to do this is I have a deployment structure where I have one build going to many clients. I want to tag deployed dll's during packaging with the client name so I can tell if dll's are copied between clients.

Upvotes: 2

Views: 199

Answers (1)

sircodesalot
sircodesalot

Reputation: 11439

I've thought about this question before myself. I figured, since assemblies are so easy to use, It seems logical that you might be able to store user generated content inside of the assembly that the program is running out of.

The problem with that line of reasoning is that would mean that someone could effectively alter the contents of the DLL without the end user realizing it (which is how many viruses work) - as you can imagine this is a massive security concern. It's far more secure / reliable if assemblies digitally signed so that you know if/when someone has tampered with the assembly.

If you want to make minor changes though before the assembly is built, however, you might try taking a look at CodeDom (which is for changing the structure of code) or Reflection.Emit (for building assemblies directly using "IL").

Upvotes: 1

Related Questions