I have created a SQL CLR that references the Windows DLL, WindowsBase. For the most part my CLR works just fine but if WindowsBase gets updated in the GAC then I get the error "Assembly in host store has a different signature than assembly in GAC.
".
To address this I built my CLR to reference a version of WindowsBase that is not in the GAC. Now when I run my CLR i get the error "Could not load file or assembly 'WindowsBase, Version=4.0.0.0, ...' or one of its dependencies. The system cannot find the file specified.
"
I set up FusLogVw to see what's going on and get the following output
The system cannot find the 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
--- A 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: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Post-policy reference: WindowsBase, Version=4.0.0.0
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
ERR: Unrecoverable error occurred during pre-download check (hr = 0x80070002).
It would appear that the assembly loader is using the machine.config file to determine where it should look for the assembly. Based on this assumption I updated the machine.config with
<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 with a relative path (relative to SQlservr.exe) and an absolute path but continue to get the same error mentioned above. Any suggestions on how to set up the SQL CLR so that it refereneces a copy of WindowsBase that is outside the GAC without getting the above errors would be greatly appreciated.
~Bugz~