Problem with assembly creation from "vjslib" on 64bit platform

Answered Problem with assembly creation from "vjslib" on 64bit platform

  • 25. července 2012 8:48
     
     

    Hi all,

    I'm trying to create assembly from vjslib.dll but it fails with the following error:<o:p></o:p>

    Msg 10300, Level 16, State 2, Line 1
    Assembly 'vjslib' references assembly 'vjslibcw, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: version, culture or public key mismatch). Please load the referenced assembly into the current database and retry your request.

    But in previous steps I have created the assembly which above error message references:<o:p></o:p>

    alter database mydb
    set trustworthy on
    GO

    use mydb
    GO

    create assembly vjscor from 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\vjscor.dll'

    with permission_set =unsafe
    GO

    create assembly vjslibcw from 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\vjslibcw.dll'

    with permission_set =unsafe
    GO

    create assembly vjslib from 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\vjslib.dll'

    with permission_set =unsafe
    GO

    The last statement raises mentioned error.

    My windows is 64bit and installed vjredist64.exe on this machine. SQL Server is 2008(x64)+sp2.

    Any help would be greatly appreciated.

    Leila

Všechny reakce

  • 26. července 2012 6:28
    Moderátor
     
     
    Hi Leila,

    For this problem, the cause most likely is vjslibcw is corrupt. Re-installing the .net framework will solve the problem.

    Another cause is, since your machine is 64bit, if the dll is stored in “framework” folder but not “Framework64” folder, it may cause the problem, please move it to 64bit folder, ie framework64.

    Best Regards,
    Iric
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • 26. července 2012 19:57
     
     

    Hi Iric,
    I changed all of paths to framework64. Now I get different error:


    create assembly vjslib from 'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\vjslib.dll'
    with permission_set =unsafe
    GO
    ---------

    Warning: The Microsoft .NET Framework assembly 'vjslib, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=amd64.' 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.

    Warning: The Microsoft .NET Framework assembly 'vjsvwaux, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.' 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.

    Warning: The Microsoft .NET Framework assembly 'system.drawing, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a, processorarchitecture=msil.' 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 6586, Level 16, State 1, Line 2
    Assembly 'System.Drawing' could not be installed because existing policy would keep it from being used.
    -------
    What's wrong?

  • 28. července 2012 17:51
    Moderátor
     
     

    Hi Leila,

    Which version of SQL Server are you using? If it's SQL Server 2012, you should use .NET 4.0 rather than .NET 2.0.

    Cheers, Bob

  • 29. července 2012 6:35
     
     

    Hi Bob,

    Thank you for your reply!

    I'm using SQL Server 2008 R2.

    I'm confused about the last error:

    Msg 6586, Level 16, State 1, Line 2
    Assembly 'System.Drawing' could not be installed because existing policy would keep it from being used.


    • Upravený Leila S 29. července 2012 6:39
    •  
  • 29. července 2012 15:12
    Moderátor
     
     Odpovědět
    It sounds like it’s a problem with .NET system assembly versioning (which would only happen with unsafe assemblies). Are you targeting .NET 3.5 SP1 (or really, the target would be .NET 3.5) is your development? That’s what version that version of SQL Server uses.
     
    I also came across this http://stackoverflow.com/questions/9190885/could-not-load-file-or-assembly-system-drawing-or-one-of-its-dependencies-erro, but it doesn’t look like the same thing. And this: https://connect.microsoft.com/SQLServer/feedback/details/694494/cannot-install-assembly-in-denali-ctp3, not quite the same. Also, search on that error number in this forum, you’ll get a number of hits.
     
    You have to be really careful when using unsafe assemblies that reference untested system assemblies.
     
    Cheers, Bob