簡體   English   中英

無法加載文件或程序集“Microsoft.SqlServer.Types,Version=10.0.0.0”或其依賴項之一

[英]Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0' or one of its dependencies

最近我開始使用 SSMS 2017 (v17.5)。 在我的 MVC 應用程序中,我收到Could not load file or assembly 'Microsoft.SqlServer.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. 錯誤。 我的應用程序中唯一改變的是Microsoft.SqlServer.Types版本,現在是14.0.0.0 以前,它是12.0.0.0

以下是我迄今為止根據我的研究嘗試過的不同選項(這包括另一篇stackoverflow文章+谷歌),但我遇到了同樣的錯誤。

  1. app.config中添加<dependentAssembly>

    <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>

  2. Application_Start方法的Global.asax.cs中添加以下行。

    SqlProviderServices.SqlServerTypesAssemblyName = "Microsoft.SqlServer.Types, Version=14.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91";

  3. 使用NuGet安裝Microsoft.SqlServer.Types

    PM> Install-Package Microsoft.SqlServer.Types

  4. 在整個項目中搜索10.0.0.0引用,但沒有找到任何引用。

  5. 我確實為2012, 2014, 20162017安裝了Microsoft System CLR Types for SQL Server

我在這里想念什么?

花了將近一天的時間后,我能夠解決這個問題。 根據我上面的問題,選項 1 對我有用。 唯一的調整是將其添加到web.config而不是app.config 希望這對其他人有幫助。

代碼:web.config

<runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Microsoft.SqlServer.Types" publicKeyToken="89845dcd8080cc91" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-14.0.0.0" newVersion="14.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
</runtime>

Microsoft.SqlServer.Types -版本 14.0.314.76 是當前版本。 嘗試更改您的版本號。 其次,檢查您的 .csproj 文件,Application 還在 .csproj 文件中維護其依賴項

對於具有相同錯誤的網絡庫項目,我轉到 NuGet 包並安裝此庫:

Microsoft.SqlServer.Types

及其作品。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM