简体   繁体   中英

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

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?

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM