简体   繁体   English

无法加载文件或程序集“ System.Configuration,版本= 4.0.0.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a”或其依赖项之一

[英]Could not load file or assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies

I am currently working on a project using Visual studio 2017 on Mac. 我目前正在使用Mac上的Visual Studio 2017进行项目。 The application is a native C# Multiplatform app for iOS and android with Xamarin. 该应用程序是带有Xamarin的iOS和android原生C#Multiplatform应用程序。

在此处输入图片说明

I am trying to interface with the CosmosDB database provided by Microsoft azure an am using the package Microsoft.Azure.DocumentDB installed through NuGet 我正在尝试使用通过NuGet安装的Microsoft.Azure.DocumentDB软件包与Microsoft azure提供的CosmosDB数据库进行交互

When initializing my client the same way as the examples in the getting started tutorial using 使用与入门教程中的示例相同的方式初始化客户端时,使用

new DocumentClient(new Uri(EndpointUrl), PrimaryKey);

However, internally, I get the exception 但是,在内部,我得到了例外

Could not load file or assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

在此处输入图片说明

I am new to visual studio and was wondering what could be causing this problem. 我是Visual Studio的新手,想知道是什么原因导致了此问题。 another package installed is 'Microsoft.Azure.Devices' Do I have to add this package to add this dll to my references? 安装的另一个软件包是“ Microsoft.Azure.Devices”是否必须添加此软件包才能将该dll添加到我的引用中? If so where can I find it? 如果可以,我在哪里可以找到它?

Here is the 'packages.config' file 这是“ packages.config”文件

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Microsoft.Azure.Amqp" version="2.3.2" targetFramework="xamarinios10" />
  <package id="Microsoft.Azure.Devices" version="1.16.0" targetFramework="xamarinios10" />
  <package id="Microsoft.Azure.Devices.Shared" version="1.15.0" targetFramework="xamarinios10" />
  <package id="Microsoft.Azure.DocumentDB" version="1.22.0" targetFramework="xamarinios10" />
  <package id="Microsoft.CSharp" version="4.5.0" targetFramework="xamarinios10" />
  <package id="Microsoft.NETCore.Platforms" version="2.1.0" targetFramework="xamarinios10" />
  <package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="xamarinios10" />
  <package id="NETStandard.Library" version="2.0.3" targetFramework="xamarinios10" />
  <package id="Newtonsoft.Json" version="11.0.2" targetFramework="xamarinios10" />
  <package id="System.AppContext" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Collections" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.ComponentModel.TypeConverter" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Console" version="4.3.1" targetFramework="xamarinios10" />
  <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Globalization" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Globalization.Calendars" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.IO" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.IO.Compression" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.IO.FileSystem" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Linq" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Linq.Expressions" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Net.Http" version="4.3.3" targetFramework="xamarinios10" />
  <package id="System.Net.Primitives" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Net.Sockets" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Net.WebSockets.Client" version="4.3.2" targetFramework="xamarinios10" />
  <package id="System.ObjectModel" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Reflection" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Reflection.Extensions" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Reflection.Primitives" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Runtime" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Runtime.Handles" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Runtime.Serialization.Formatters" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Runtime.Serialization.Primitives" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="xamarinios10" />
  <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="xamarinios10" />
  <package id="System.Text.Encoding" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Threading" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Threading.Tasks" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Threading.Timer" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="xamarinios10" />
  <package id="System.Xml.XDocument" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Xml.XmlDocument" version="4.3.0" targetFramework="xamarinios10" />
  <package id="System.Configuration.ConfigurationManager" version="4.5.0" targetFramework="xamarinios10" />
  <package id="System.Security.AccessControl" version="4.5.0" targetFramework="xamarinios10" />
  <package id="System.Security.Permissions" version="4.5.0" targetFramework="xamarinios10" />
  <package id="System.Security.Principal.Windows" version="4.5.0" targetFramework="xamarinios10" />
</packages>

It turns out that Microsoft.Azure.DocumentDB is not compatible with Xamarin. 事实证明Microsoft.Azure.DocumentDB与Xamarin不兼容。 Everything works fine if instead we use Microsoft.Azure.DocumentDB.Core 如果相反,我们使用Microsoft.Azure.DocumentDB.Core,则一切正常

As Jason said, you could try to install System.Configuration.ConfigurationManager to ensure Configuration contain ConfigurationManager attrribute. 如Jason所说,您可以尝试安装System.Configuration.ConfigurationManager以确保Configuration包含ConfigurationManager属性。

If you are using VS for Mac then currently you will need to add one PackageReference into the .csproj manually by using a text editor. 如果您在Mac上使用VS,则当前需要使用文本编辑器将一个PackageReference手动PackageReference.csproj

<ItemGroup>
    <PackageReference Include="Xamarin.Forms" Version="2.4.0.280" />
</ItemGroup>

For more details, you could refer to this discussion . 有关更多详细信息,您可以参考此讨论

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集“System.Runtime,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一 - Could not load file or assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies 无法加载文件或程序集“System.IO,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a”或其依赖项之一 - Could not load file or assembly 'System.IO, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies 无法加载文件或程序集“System.Net.Http,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a” - Could not load file or assembly "System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 未找到此程序集:“System.Net.Http,版本=4.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a” - This assembly is not found: 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 无法加载文件或程序集“System.Runtime,Version=6.0.0.0,Culture=neutral,PublicKeyToken-b03f5f7f11d50a3a”或其依赖项之一 - Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken-b03f5f7f11d50a3a' or one of its dependencies Azure应用服务 - 无法加载文件或程序集&#39;System.Net.Http,Version = 4.2.0.0,Culture = neutral,PublicKeyToken = b03f5f7f11d50a3a&#39; - Azure app service - Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' linqpad无法加载文件或程序集&#39;System.Runtime,版本= 4.1.0.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a&#39; - linqpad Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' 无法加载文件或程序集“System.Runtime,版本=4.2.1.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a” - Could not load file or assembly 'System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' &#39;无法加载文件或程序集&#39;System.Runtime,版本= 4.1.0.0,区域性=中性,PublicKeyToken = b03f5f7f11d50a3a&#39; - 'Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' NET 核心 - 无法加载文件或程序集'System.Runtime,版本 = 6.0.0.0,文化 = 中性,PublicKeyToken = b03f5f7f11d50a3a',.NET 6 - NET core - Could not load file or assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ', .NET 6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM