Is it possible to change a name of a field in .net assembly? I use that assembly in some case insensitive scripting environment which complains that this public field is not CLS compliant. In the same class there is a property with the same name, just the first letter of field and property differs in case. Unfortunately, i don't have sources. Ideally, i would mark it private or add _ in field's name. I wonder if there is a tool that allow such thing as renaming metadata of the class. I thought about using redgate reflector to extract code and modify and compile back into assembly. But that just doesn't work for me.
Asked
Active
Viewed 254 times
3
-
I _think_ you have no choice other than to decompile, alter and recompile. With IL(D)ASM you'll have the least trouble getting it to compile again. – CodeCaster Sep 28 '15 at 21:31
-
2You _may_ be able to get away with using a tool such as [Reflexil](http://reflexil.net/), but not sure. – Brad Christie Sep 28 '15 at 21:35
-
Another thing you need to consider is whether or not the assembly is _strongly signed_. If it is, Reflexil won't be able to do that for you, since it's using Mono.Cecil under the hood, and that needs the private key for it. In such as case, your only option is decompiling it, etc. ([the approach](http://stackoverflow.com/questions/32831921/change-name-of-field-of-net-class-in-assembly#comment53500099_32831921) of CodeCaster) – Ties Sep 28 '15 at 21:50
-
I tried Reflexil, and it worked as magic! Exactly what i was looking for. I downloaded it as plugin to reflector. Right click on field displays the rename option. Clicking on it will show prompt for new name. After dismissing it field was renamed and all references updated. Cool tool! – Andrey Sep 28 '15 at 23:55