wpf - Error in adding assembly from dll in C# codedom compiler parameter -
i working on c# codedom project provides users dynamically compile c# code. getting error when adding assembly dll of wpf (it working fine winforms). saying "can not find #### in assembly. missing reference" when try add reference "system.windows.media". when adding reference dll path "c:\program files\reference assemblies\microsoft\framework\v3.0\system.printing.dll" saying "file c:\program files\reference assemblies\microsoft\framework\v3.0\system.printing.dll not found" when place system.printing.dll application executable folder, working fine.
following code using add reference compiler option:
compilerparameters oparameters; : : : string lcassemblydll="c:\program files\reference assemblies\microsoft\framework\v3.0\system.printing.dll"; oparameters.referencedassemblies.add(lcassemblydll);
i not able understand problem. there other approach add wpf assemblies?
thanks
well, can't provide thorough answer off top of head, first of need realize compilation reference not same being able resolve assembly during application execution. if error given during application execution can imagine throwing typeloader exceptions.
second getting "can not find #### in assembly. missing reference", because base types of classes dependent upon reside in assemblies system.windows.media referring.
you try solve adding references assemblies loaded during assembly.reflectiononlyload of assemblies want referred. if add event handler appdomain.currentdomain.reflectiononlyassemblyresolve, can add code makes sure assemblies may loaded , add references codecompileunit.
i have run 1 problem though , references optimized away during compilation, implemented nasty hack adds container class codecompileunit initializies first constructable type found in each of assemblies.
hope helps bit.
Comments
Post a Comment