Visual Studio `reference` needed to enable use of the Obfuscar attribute

852 Views Asked by At

My Obfuscar configuration does not seem to skip types the way I expected. I'm trying the alternative approach to obfuscate only what is marked.

I enabled marking with the configuration element <Var name="MarkedOnly" value="true" />

In front of C# object definitions I am trying to mark for obfuscation using the [Obfuscate] attribute. The instructions at http://obfuscar.codeplex.com/wikipage?title=Configuration&referringTitle=Documentation are to "reference Obfuscar.exe". Neither the xxx_bin.zip nor the xxx_src.zip downloads contain such file. I tried to reference Obfuscar.Console.exe and Obfuscar.dll in Visual Studio. In both cases the [Obfuscate] attribute is not recognized.

How can I setup to get this attribute to be recognized?

2

There are 2 best solutions below

0
On BEST ANSWER

That attribute is obsolete and you should use System.Reflection.ObfuscationAttribute instead. Forgot to update the wiki page to reflect the changes.

0
On

If you add reference to Obfuscar.dll with copy local = true and add using Obfuscar; to the class in question, you will be able to use attributes.

Also, you don't add the .exe as a reference, instead copy to release folder. You can do this by adding as a link and Copy to Output directory or xcopy pre-build event etc.