mscorlib version=2.0.5.0 issue when trying to CREATE ASSEMBLY in SQL Server 2012

  • Trying to CREATE ASSEMBLY in MS SQL Server 2012 SP1.

    Assembly was developed in Visual Studio 2010 as a SQL Server Database Project targeting SQL Server 2012 platform and .NET Framework 4.

    It references Google.Apis.Admin.Directory.directory_v1 as well as other DLLs included in the nuget package for this assembly.

    Create ASSEMBLY [XXXX] from

    'C:\Visual Studio 2010\Projects\XXXX\XXXX\bin\Debug\XXXX.dll'

    WITH PERMISSION_SET = UNSAFE;

    GO

    Returns the following error.

    Msg 10301, Level 16, State 1, Line 1

    Assembly 'XXXX' references assembly 'mscorlib, version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e.', 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: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.

    Has anyone encounter this issue?

  • Has anyone found a solution to this?

  • damien.tiede - Thursday, February 22, 2018 1:45 PM

    Has anyone found a solution to this?

    Try changing your target framework to a higher version if you are getting the exact same message.

    Sue

  • bhee - Friday, March 13, 2015 8:28 AM

    Trying to CREATE ASSEMBLY in MS SQL Server 2012 SP1.Assembly was developed in Visual Studio 2010 as a SQL Server Database Project targeting SQL Server 2012 platform and .NET Framework 4.It references Google.Apis.Admin.Directory.directory_v1 as well as other DLLs included in the nuget package for this assembly.Create ASSEMBLY [XXXX] from 'C:\Visual Studio 2010\Projects\XXXX\XXXX\bin\Debug\XXXX.dll' WITH PERMISSION_SET = UNSAFE;GOReturns the following error.Msg 10301, Level 16, State 1, Line 1Assembly 'XXXX' references assembly 'mscorlib, version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e.', 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: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.Has anyone encounter this issue?

    I ran into the similar situation several times and was ever in pain for days. My final workaround is, to recompile the SQL CLR by .Net 3.5 or 2.0.  I'm very happy if somebody here can figure out a way to fix it without the need to recompile SQL CLR.

    GASQL.com - Focus on Database and Cloud

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply