'Microsoft.SqlServer.Types, Version=11.0.0.0 missing

I have published the project on Azure websites and it throws exception:

Microsoft.SqlServer.Types, Version=11.0.0.0 missing when I try to run report. Locally everything works fine. I have RepowrtViewer.WebForms and ReportViewer.Common both version 11.0.0.0 in the project. On the machine locally in SDK/Assemblies

I have Microsoft.SqlServer.Types, Version=11.0..2100.6. I have tried to add this to the project but did not work. The same exception,

Where do I find Microsoft.SqlServer.Types 11.0.0.0?

Thank you



Solution 1:[1]

You're probably referencing the DLL's from the global assembly cache on your local machine but they aren't present in the GAC in Azure.

Open up visual studio and right click on the Microsoft.SqlServer.Types assembly reference in your project and select properties. Change the copy local flag from False to True and recompile your application. You should now have the the Microsoft.SqlServer.Types.dll file in your applications bin folder.

Redeploy to azure and hopefully the error will have vanished.

Solution 2:[2]

How I got this solved.

I had to add 5 files altogether and I moved these 5 files to my bin directory. I then added these references by browsing to the bin directory and adding them. I rebuilt my project and copied to web server - all working fine.

  1. Microsoft.SqlServer.Types.dll (make sure you copy the correct version as I had sql 2008 but using report viewer 11)
  2. Microsoft.ReportViewer.ProcessingObjectModel.dll
  3. Microsoft.ReportViewer.Common.dll
  4. Microsoft.ReportViewer.WebForms.dll
  5. Microsoft.ReportViewer.WinForms.dll

Also make sure you have the correct version of these dll's from the GAC in the bin directory and I installed report viewer on the server. These are the steps that worked for me.

Solution 3:[3]

The best solution would be to install the Microsoft.SqlServer.Types NuGet package.

PM> Install-Package Microsoft.SqlServer.Types

And follow instructions from its readme.htm

Solution 4:[4]

I had exactly the same issue but found the solution quite quickly. It was using the Assembly within this folder C:\Program Files (x86)\Microsoft SQL Server\100 where I then removed my reference via Visual Studio and referenced the right file from within this folder C:\Program Files (x86)\Microsoft SQL Server\110

If you still need this reference then please make use of this method.

Cheers,

Solution 5:[5]

Check your SQL server ProductVersion using the following query,

SELECT  
  SERVERPROPERTY('MachineName') AS ComputerName,
  SERVERPROPERTY('ServerName') AS InstanceName,  
  SERVERPROPERTY('Edition') AS Edition,
  SERVERPROPERTY('ProductVersion') AS ProductVersion,  
  SERVERPROPERTY('ProductLevel') AS ProductLevel;  
GO  

It will be like something this,

enter image description here

You can see in my case ProductVersion = 13.0.1601.5. In your project go to NuGet package manager and search Microsoft.SqlServer.Types. From there you can see, Microsoft.SqlServer.Types with the same ProductVersion and Install it.

enter image description here

Solution 6:[6]

My Experience

I used to face this kind of problems until I understand the GAC and Bin deploy

Your computer has all the installed DLLs into a place called GAC (Global Assembly Cache). so your local programs can search for their needs in there if they can not find the required DLL in the execution path. It's often work for developer itself, but when you deploy your program to the client, problems may appear.

Remember that, you can always Bin deploy your DLLs. first, go to the references tree in your project and add the required Dll by browsing your GAC (usually c:\windows\assembly\GAC_MSIL...) then go to the property window of the added Dll and set Copy Local to True . Now you can publish or deploy your project and be sure that it will works.

Solution 7:[7]

Make sure you are not missing a binding redirect

  <dependentAssembly>
      <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
      <bindingRedirect oldVersion="10.0.0.0-11.0.0.0" newVersion="14.0.0.0" />
    </dependentAssembly>

Solution 8:[8]

https://www.microsoft.com/en-us/download/details.aspx?id=56041 Download from here if this needs to be installed in your machine

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AndyM
Solution 2 Lucas Zamboulis
Solution 3 Ben Novoselsky
Solution 4 Domondios
Solution 5 Sachith Wickramaarachchi
Solution 6
Solution 7 Lord Darth Vader
Solution 8 sathiaseelan V