Tuesday, 15 September 2015

c# - force app to ignore local assemblies and use SxS or vice versa -



c# - force app to ignore local assemblies and use SxS or vice versa -

i have application deployed in 2 flavors, wix installer in person administrator, or click-once installer user no elevated privileges. has dependency on set of 3rd party dlls designed deployed in sxs manner. due need elevated privileges install winsxs click-once install needs install files locally bin directory of application. possible in wix install also, , causes no problems, there problem...

other 3rd (or 4th) party applications using same set of dlls install them winsxs, , when our application loads accesses both local version , version in winsxs. causes unusual ui corruption respect resources loaded unmanaged resource dll sxs dlls.

to complicate matters dlls in shared sxs set 3rd party have manifest embedded specifies dependency on sxs set directly.

i have tried adding application manifest dependency on sxs set problem persists both versions accessed:

<dependency> <dependentassembly> <assemblyidentity name="sharedsxs" version="12.1.369.0" publickeytoken="1255b113b2b03444" type="win32"/> </dependentassembly> </dependency>

but top no avail.

my question this:

is there way go on application running if no other applications installed on machine , dlls in application bin directory, whilst running if application installs dlls winsxs. in other words, can forcefulness application load exclusively winsxs or locally ever nowadays in both scenarios dlls exist in winsxs or not.

extra info

the application accesses dll using dllimport:

[dllimport("externaldll.dll", entrypoint = "_dostuff@12")] [clscompliantattribute(false)] public static extern intptr dostuffex(string name, string reserved, uint uiflags);

and dll has embedded manifest:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0"> <assemblyidentity name="externaldll.dll" processorarchitecture="x86" type="win32" version="12.0.0.0"></assemblyidentity> <dependency> <dependentassembly> <assemblyidentity name="sharedsxs" version="12.1.369.0" publickeytoken="1255b113b2b03444" type="win32"/> </dependentassembly> </dependency> </assembly>

and sxs manifest looks follows:

<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestversion="1.0"> <assemblyidentity type="win32" name="sharedsxs" version="12.1.369.0" publickeytoken="1255b113b2b03444"></assemblyidentity> <file name="externaldll.dll" hashalg="sha1" hash="cb2ecfaca2d62cd9f5c559cf21d502921881155f"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:transforms><dsig:transform algorithm="urn:schemas-microsoft-com:hashtransforms.identity"></dsig:transform></dsig:transforms><dsig:digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:digestmethod><dsig:digestvalue>blyj40vjd++ih9xtg0ooczhisl4=</dsig:digestvalue></asmv2:hash></file> <file name="otherdll.dll" hashalg="sha1" hash="246d082823724f42d5630dba1b9dcde3e2c1b76d"><asmv2:hash xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"><dsig:transforms><dsig:transform algorithm="urn:schemas-microsoft-com:hashtransforms.identity"></dsig:transform></dsig:transforms><dsig:digestmethod algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></dsig:digestmethod><dsig:digestvalue>me1el8p76nkfd1o9l058m8gudaw=</dsig:digestvalue></asmv2:hash></file> </assembly>

there 4 scenarios:

application has no manifest, sxs not installed -> app loads dll locally if nowadays else fails application has manifest, sxs not installed -> app loads dll locally if nowadays else fails

application has no manifest, sxs nowadays ->

a. app loads dll locally if present, dll loads dependency sxs corruption occurs

b. no local dll, app fails

application has manifest, sxs nowadays ->

a. app loads dll locally if present, dll loads dependency sxs corruption occurs

b. no local dll, app loads sxs well

there 2 scenarios need create work:

dll in local folder (none in sxs) dll in local folder , sxs

i have total command on application manifest , dllimport modification needed here under control. scenario dlls in sxs irrelevant.

how install local assemblies? did seek installing them in assembly name folder?

yourapp.exe sharedsxs/externaldll.dll sharedsxs/sharedsxs.manifest sharedsxs/otherdll.dll

then apps without manifest not find dlls @ all, , apps manifest prefer global re-create before local copy, never using both.

c# .net dll manifest winsxs

No comments:

Post a Comment