Using the [CallerFilePath]
attribute in C# leads to the inclusion of full local file paths in the compiled CIL binaries, such as C:\Users\MyName\Projects\Project\File.cs
.
Is there a way of amending these strings in the compiled binaries? Perhaps as a build step to remove the "C:\Users\MyName\Projects\", but leave the remainder for logging purposes?
Off the top of my head, I can only think of ildasm
'ing it, search & replacing, and then ilasm
ing it - but this seems like a rather involved process. I also came across references to the STRINGTABLE
resource, but without any implementation details on how to post-process it.
There are a couple of suggested duplicates, including this one, but I don't think this is a duplicate question as this one refers to the [CallerFilePath]
attribute specifically, and not to debug-configuration related strings that point to pdb
files.
Aucun commentaire:
Enregistrer un commentaire