sqlclr - SQL Server custom CLR fails with error "Could not load file or assembly or one of its dependencies. The system cannot find the file specified." -


i have created sql clr references windows dll, windowsbase. part clr works fine if windowsbase gets updated in gac error "assembly in host store has different signature assembly in gac.".

to address built clr reference version of windowsbase not in gac. when run clr error "could not load file or assembly 'windowsbase, version=4.0.0.0, ...' or 1 of dependencies. system cannot find file specified."

i set fuslogvw see what's going on , following output

the system cannot find file specified.  assembly manager loaded from:  c:\windows\microsoft.net\framework64\v4.0.30319\clr.dll running under executable  c:\program files\microsoft sql server\mssql11.mssqlserver\mssql\binn\sqlservr.exe --- detailed error log follows.   === pre-bind state information ===     log: displayname = windowsbase, version=4.0.0.0     log: appbase = file:///c:/program files/microsoft sql server/mssql11.mssqlserver/mssql/binn/     log: initial privatepath = null     log: dynamic base = null     log: cache base = null     log: appname = sqlservr.exe     calling assembly : (unknown).     ===     log: bind starts in default load context.     log: no application configuration file found.     log: using host configuration file:      log: using machine configuration file c:\windows\microsoft.net\framework64\v4.0.30319\config\machine.config.     log: post-policy reference: windowsbase, version=4.0.0.0     log: same bind seen before, , failed hr = 0x80070002.     err: unrecoverable error occurred during pre-download check (hr = 0x80070002). 

it appear assembly loader using machine.config file determine should assembly. based on assumption updated machine.config

<runtime>     <assemblybinding xmlns="urn:schemas-microsoft-com:asm.v1">         <dependentassembly>              <assemblyidentity name="windowsbase"... />               <codbase version="4.0.0.0"                    href="./additionalassemblies/windowsbase.dll"/>         </dependentassembly>     </assemblybinding> </runtime> 

i have tried relative path (relative sqlservr.exe) , absolute path continue same error mentioned above. suggestions on how set sql clr refereneces copy of windowsbase outside gac without getting above errors appreciated.

~bugz~

what attempting not supported sql server's clr host. clr within sql server highly restricted prevent destabilizing sql server since works differently apps running on os. so, there limited set of dlls supported (i.e. verified work , guaranteed stay working across updates .net). windowsbase not 1 of them need load manually unsafe sql server. leaves either problem ran of version in main gac changing (dlls common between gac , sql server's clr host must same version), or worse, if dll becomes "mixed" (both unmanaged c++ , managed code) , no longer "pure". in case new version not load , old version gets "wrong version" error have work do.

for more detailed information, please see following articles / documentation:

that set of links taken "additional reading" section of article wrote: stairway sqlclr level 5: development (using .net within sql server) (free registration required)


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -