.net - Linking a precompiled MSIL file into an assembly? -


is there way precompile msil file , have .net linker link .net assembly @ compile time?

so, example. have project. compile it, decompile msil, , tweak msil.

now then, i'd compile , link tweaked msil file project.

yes, +could+ recompile seperate assembly , reference it, in particular case, can't that. contents of msil needs in target assembly.

any ideas if possible? far, i've had no luck finding anything.

-- edit-- 1 suggestion ilmerge, might work. i'll grabbing latest copy , see how fairs. issue have in past, i've found debugging difficult after merge (or @ least, more difficult if didn't use ilmerge). hoping possibly tweak proj file include compiled msil directly part of build process, continue debugged in ide.

-- edit -- well, doesn't ilmerge work scenario first, got message: exception occurred during merging: (taskid:32) ilmerge.merge: assembly 'blah' not marked containing managed code. (taskid:32) (consider using /zeropekind option -- read documentation first!) (taskid:32) @ ilmerging.ilmerge.merge() (taskid:32) @ ilmerging.ilmerge.main(string[] args) (taskid:32)

ok. so, heck, add /zeropekind , try again.

no error!

but, in particular case, dll being merged in has several functions tweaked in msil exported cdecl functions. in merged dll, no longer exported.

rats.

back square one.

you can use ilmerge combine multiple assemblies one, tweak msil, make seperate assembly, ilmerge first one.

another alternative load tweaked msil embedded resource in first assembly (which mean tweaked msil assembly have created before 1 references it) @ runtime can read byte[] of embedded resource assembly, loaded appdomain.

a third, more drastic approach decompile both assemblies, , combine output msil files 1, , rebuild assembly. have watch out naming conflicts between 2 sets of msil code, since can dump msil flat text file, shouldn't difficult write utility program recombine them... although, thats ilmerge is, except starts 2 assemblies, instead of msil code in text file...


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -