title: Assembly 'Microsoft.SqlServer.Types' version 10 or higher could not be found
body: <p>I Have a problem. I'm not able to add a Migration to my ASP.NET WebAPI 2 Project. I get error: </p>
  
  <blockquote>
    <p>"Spatial types and functions are not available for this provider
    because the assembly 'Microsoft.SqlServer.Types' version 10 or higher
    could not be found."</p>
  </blockquote>
  
  <p>I know there are several questions and answers about this, like:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/13174197/microsoft-sqlserver-types-version-10-or-higher-could-not-be-found-on-azure">&#39;Microsoft.SqlServer.Types&#39; version 10 or higher could not be found on Azure</a></li>
  <li><a href="https://stackoverflow.com/questions/39104536/spatial-types-and-functions-are-not-available-error-when-converting-a-string-t">&quot;Spatial types and functions are not available&quot; error when converting a string to DbGeometry in ASP.NET</a></li>
  </ul>
  
  <p>But! The problem is...</p>
  
  <ul>
  <li>I already have installed Microsoft.SqlServer.Types.</li>
  <li>I already have Global.asax configured with: <strong>SqlServerTypes.Utilities.LoadNativeAssemblies(Server.MapPath("~/bin"))</strong> into the Application_Start.</li>
  <li>Reference is set to local copy > true.</li>
  <li>NuGet packages are all updated.</li>
  <li>I already try to downgrade and upgrade the package.</li>
  </ul>
  
  <p>This is the full error when I try to run for example <strong>Add-Migration v002</strong>:</p>
  
  <blockquote>
    <p>System.InvalidOperationException: Spatial types and functions are not
    available for this provider because the assembly
    'Microsoft.SqlServer.Types' version 10 or higher could not be found.<br>
    en
    System.Data.Entity.SqlServer.SqlTypesAssemblyLoader.GetSqlTypesAssembly()
    en
    System.Data.Entity.SqlServer.SqlSpatialServices.GeographyFromText(String
    wellKnownText)    en
    System.Data.Entity.Spatial.DbGeography.FromText(String wellKnownText) 
    en
    System.Data.Entity.Migrations.Model.ColumnModel.CreateDefaultValue()<br>
    en
    System.Data.Entity.Migrations.Model.ColumnModel..ctor(PrimitiveTypeKind
    type, TypeUsage typeUsage)    en
    System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty
    property, TypeUsage conceptualTypeUsage, TypeUsage
    defaultStoreTypeUsage, IDictionary<code>2 annotations)    en
    System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildColumnModel(EdmProperty
    property, ModelMetadata modelMetadata, IDictionary</code>2 annotations)<br>
    en
    System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.&lt;>c__DisplayClass2e3.b__2df(EdmProperty
    p)    en
    System.Data.Entity.Utilities.IEnumerableExtensions.Each[T](IEnumerable<code>1
    ts, Action</code>1 action)    en
    System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.BuildCreateTableOperation(EntitySet
    entitySet, ModelMetadata modelMetadata)    en
    System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.b__194(EntitySet
    es)    en
    System.Linq.Enumerable.WhereSelectEnumerableIterator<code>2.MoveNext()<br>
    en System.Collections.Generic.List</code>1..ctor(IEnumerable<code>1 collection)<br>
    en System.Linq.Enumerable.ToList[TSource](IEnumerable</code>1 source)    en
    System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(ModelMetadata
    source, ModelMetadata target, Lazy<code>1 modificationCommandTreeGenerator,
    MigrationSqlGenerator migrationSqlGenerator, String
    sourceModelVersion, String targetModelVersion)    en
    System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument
    sourceModel, XDocument targetModel, Lazy</code>1
    modificationCommandTreeGenerator, MigrationSqlGenerator
    migrationSqlGenerator, String sourceModelVersion, String
    targetModelVersion)    en
    System.Data.Entity.Migrations.DbMigrator.Scaffold(String
    migrationName, String namespace, Boolean ignoreChanges)    en
    System.Data.Entity.Migrations.Design.MigrationScaffolder.Scaffold(String
    migrationName, Boolean ignoreChanges)    en
    System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Scaffold(MigrationScaffolder
    scaffolder)    en
    System.Data.Entity.Migrations.Design.ToolingFacade.ScaffoldRunner.Run()
    en System.AppDomain.DoCallBack(CrossAppDomainDelegate
    callBackDelegate)    en
    System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)<br>
    en System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner
    runner)    en
    System.Data.Entity.Migrations.Design.ToolingFacade.Scaffold(String
    migrationName, String language, String rootNamespace, Boolean
    ignoreChanges)    en
    System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name,
    Boolean force, Boolean ignoreChanges)    en
    System.Data.Entity.Migrations.AddMigrationCommand.&lt;>c__DisplayClass2.&lt;.ctor>b__0()
    en
    System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action
    command)</p>
  </blockquote>