2016-04-03 2 views
1

J'expérimente avec l'ajout de support personnalisé pour le R language dans SQL Server 2014.La commande TSQL "Create Assembly" échoue vérification sur SQL Server?

Je veux installer MEF, pour permettre cela.

Je lance ce SQL ...

CREATE ASSEMBLY [System.ComponentModel.Composition] 
AUTHORIZATION [dbo] 
from 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.ComponentModel.Composition.dll' 
WITH PERMISSION_SET = SAFE 

... mais je reçois cette erreur:

Warning: The Microsoft .NET Framework assembly 'system.componentmodel.composition, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089.' you are registering is not fully tested in the SQL Server hosted environment and is not supported. In the future, if you upgrade or service this assembly or the .NET Framework, your CLR integration routine may stop working. Please refer SQL Server Books Online for more details. 
Msg 6218, Level 16, State 2, Line 56 
CREATE ASSEMBLY for assembly 'System.ComponentModel.Composition' failed because assembly 'System.ComponentModel.Composition' failed verification. Check if the referenced assemblies are up-to-date and trusted (for external_access or unsafe) to execute in the database. CLR Verifier error messages if any will follow this message 
[ : Microsoft.Internal.Assumes::NotNull[T]][mdToken=0x6000001][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.Assumes::NotNull[T1,T2]][mdToken=0x6000002][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.Assumes::NotNull[T1,T2,T3]][mdToken=0x6000003][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.Assumes::Null[T]][mdToken=0x6000005][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.Assumes::NotReachable[T]][mdToken=0x600000a][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.Assumes::NotNullOrEmpty][mdToken=0x6000004][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.Assumes::IsFalse][mdToken=0x6000006][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.Assumes::IsTrue][mdToken=0x6000007][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.Assumes::IsTrue][mdToken=0x6000008][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.Assumes::Fail][mdToken=0x6000009][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.AttributeServices::GetAttributes[T]][mdToken=0x600000b][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.AttributeServices::GetAttributes[T]][mdToken=0x600000c][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.AttributeServices::GetFirstAttribute[T]][mdToken=0x600000d][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.AttributeServices::GetFirstAttribute[T]][mdToken=0x600000e][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.AttributeServices::IsAttributeDefined[T]][mdToken=0x600000f][offset 0x00000000] Code size is zero. 
[ : Microsoft.Internal.AttributeServices::IsAttributeDefined[T]][mdToken=0x6000010][offset 0... 

Répondre

1

Il se trouve que j'étais using the "reference" .dll, not the actual "framework" .dll. Cela a fonctionné bien:

CREATE ASSEMBLY [System.ComponentModel.Composition] 
AUTHORIZATION [dbo] 
from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.ComponentModel.Composition.dll' 
WITH PERMISSION_SET = UNSAFE 

Pour éviter d'avoir à deviner quel dossier à importer à partir, exécutez cette requête:

select * from sys.dm_clr_properties 

enter image description here

+0

Si quelqu'un trouve la réponse liée au sujet [référence vs DLL réelle] (http://stackoverflow.com/questions/24835036/cant-add-system-io-compression-to-trusted-assemblies-in-sql-server) utile, n'oubliez pas d'upvote cette réponse ;-). –

+1

Fait! Et si vous pouvez trouver un moyen de charger des assemblages en mode mixte dans SQLCLR, je vais trouver un moyen de vous donner 50 réputation :) – Contango

+0

Merci. Et malheureusement, il n'est pas possible de charger des assemblys en mode mixte. C'est vraiment une restriction qui interdit le chargement de certaines bibliothèques Framework. Est-ce le problème? –