c# - CompileAssemblyFromSource + Obfuscation = don't work -


i have working compileassemblyfromsource code. when use code protector redgate smartassembly or themida it's stop working , error "could not load file or assembly or 1 of dependencies". can please me that?

using system; using system.codedom.compiler; using system.reflection; using microsoft.csharp;  namespace stringtocode {     public class program     {         public static int q = 0;         static void main(string[] args)         {             try             {                 string source = "namespace stringtocode { public class fooclass { public void execute() { program.q = 1; } } }";                  console.writeline("q=" + q);                 using (var foo = new csharpcodeprovider())                 {                     var parameters = new compilerparameters();                     parameters.generateinmemory = true;                      foreach (assembly assembly in appdomain.currentdomain.getassemblies())                     {                         try                         {                             string location = assembly.location;                             if (!string.isnullorempty(location))                             {                                 parameters.referencedassemblies.add(location);                             }                         }                         catch (notsupportedexception)                         { }                     }                      var res = foo.compileassemblyfromsource(parameters, source);                     var type = res.compiledassembly.gettype("stringtocode.fooclass");                     var obj = activator.createinstance(type);                     var output = type.getmethod("execute").invoke(obj, new object[] { });                      console.writeline("q=" + q);                 }             }             catch (exception e)             {                console.writeline(e.message);;             }             console.readline();         }     } } 

sorry question. understand why happens) code example. main problem have code server. when obfuscate vars don't obfuscare them @ "online" code use compileassemblyfromsource. can't work. because vars don't have same names.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -