64bit - Analyze 64-bit DLL from within T4 template in Visual Studio (32-bit) using Reflection -


i analyse dll within t4 template using reflection, can generate code based on results of reflection analysis. know envdte better option, not possible in case several reasons.

the problem reflection dll 64-bit dll , if load within t4 template badimageformatexception because trying load 64-bit dll 32-bit process (visual studio 2012).

is there way analyse contents of dll within t4, preferrably using reflection?

i have thought writing console application analyses dll, writes results xml file consumed t4 template, not favorite solution...

btw: dll managed c++ dll. roslyn no option either because supports c# , vb).

a thing worth testing if loading assembly reflection works you. did experiment bit , seems succeeds loading 64bit assembly 32bit process then. can't execute should ok if understood correctly:

for full sample at: https://github.com/mrange/codestack/tree/master/q18985529/reflect

var assembly = assembly.reflectiononlyload ("x64");  var types = assembly.gettypes ();  foreach (var type in types) {     console.writeline (type.fullname);      foreach (var field in type.getfields ())     {         console.writeline ("  {0} {1}", field.fieldtype, field.name);     }      foreach (var property in type.getproperties ())     {         console.writeline ("  {0} {1}", property.propertytype, property.name);     }  } 

loading reflectiononly has drawbacks iirc it's worth it.


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -