In this test both Buffalo.dll, BuffaloAOP.exe and client.exe are the release build.
c:\Temp\Buffalo>BuffaloAOP.exe "C:\Users\Wei.Liao\Documents\Visual Studio 2012\P
rojects\buffalo\client\bin\release\client.exe"
Unhandled Exception: System.BadImageFormatException: Could not load file or asse
mbly 'file:///C:\Users\Wei.Liao\Documents\Visual Studio 2012\Projects\buffalo\cl
ient\bin\release\client.exe' or one of its dependencies. An attempt was made to
load a program with an incorrect format.
at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String cod
eBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&
stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntro
spection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName as
semblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMar
k& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIn
trospection, Boolean suppressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName as
semblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMar
k& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean sup
pressSecurityChecks)
at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Ev
idence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm,
Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackM
ark)
at System.Reflection.Assembly.LoadFrom(String assemblyFile)
at Buffalo.BoundaryObject.DoSomething(AppDomainArgs ada, String path)
at Buffalo.Weaver.SetUnderlyingAspectTypes()
at Buffalo.Weaver.Init()
at BuffaloAOP.Program.Main(String[] args)
debug build can inject release build "client.exe" with no problem. for release build BuffaloAOP to work, I had to change the build target of client.exe to "Any CPU", to match that of BuffaloAOP and buffalo.dll.
In this test both Buffalo.dll, BuffaloAOP.exe and client.exe are the release build.
c:\Temp\Buffalo>BuffaloAOP.exe "C:\Users\Wei.Liao\Documents\Visual Studio 2012\P rojects\buffalo\client\bin\release\client.exe"
Unhandled Exception: System.BadImageFormatException: Could not load file or asse mbly 'file:///C:\Users\Wei.Liao\Documents\Visual Studio 2012\Projects\buffalo\cl ient\bin\release\client.exe' or one of its dependencies. An attempt was made to load a program with an incorrect format. at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String cod eBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntro spection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName as semblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMar k& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIn trospection, Boolean suppressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName as semblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMar k& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean sup pressSecurityChecks) at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Ev idence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackM ark) at System.Reflection.Assembly.LoadFrom(String assemblyFile) at Buffalo.BoundaryObject.DoSomething(AppDomainArgs ada, String path) at Buffalo.Weaver.SetUnderlyingAspectTypes() at Buffalo.Weaver.Init() at BuffaloAOP.Program.Main(String[] args)