1

General

I am developing a mobile application using the Xamarin framework. The project is quite large and uses several nuget packages.

Environment

  • Xamarin.Forms v2.5.0.122203
  • Xamarin for VS2015 4.9.0.753
  • Visual Studio Professional 2015
  • Mono.Android v6

  • Target framework Android 6.0 (Marshmallow)
  • Minimum Android version 4.4.87 (API 20 - Kit Kat)

Suddenly after installing some packages (I can't remember which one) I get the following error

error

Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Web, Version=4.0.0.0'

It seems like a package uses System.Web.

So I thought I could just add the reference from here

  • C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\vX.X

The project is compiling and starting. But instantly after starting the app on my tablet, it crashes.

Debug output

04-24 10:30:02.924 D/Mono (26732): Assembly Loader probing location: 'System.Web'.

04-24 10:30:02.924 F/monodroid-assembly(26732): Could not load assembly 'System.Web' during startup registration.

04-24 10:30:02.924 F/monodroid-assembly(26732): This might be due to an invalid debug installation.

04-24 10:30:02.924 F/monodroid-assembly(26732): A common cause is to 'adb install' the app directly instead of doing from the IDE.

I don't assume anyone has a clear solution for this. Is there a tool which tells me, what package references System.Web?

Thanks in advance!

packages.config

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="Acr.UserDialogs" version="6.3.8" targetFramework="portable46-net451+win81" />
  <package id="ExifLib.PCL" version="1.0.1" targetFramework="portable46-net451+win81" />
  <package id="FAKE" version="4.35.0" targetFramework="portable46-net451+win81" />
  <package id="FluentValidation" version="6.2.1.0" targetFramework="portable46-net451+win81" />
  <package id="HWebbuilder.Enum" version="0.2.3" targetFramework="portable46-net451+win81" />
  <package id="HWebbuilder.HCirsSmart.Shared" version="0.1.5" targetFramework="portable46-net451+win81" />
  <package id="HWebbuilder.Interface" version="0.1.12" targetFramework="portable46-net451+win81" />
  <package id="Microsoft.Bcl" version="1.1.10" targetFramework="portable45-net45+win8+wp8+wpa81" requireReinstallation="true" />
  <package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="portable45-net45+win8+wp8+wpa81" />
  <package id="Microsoft.CSharp" version="4.0.1" targetFramework="portable46-net451+win81" />
  <package id="Microsoft.Net.Http" version="2.2.29" targetFramework="portable46-net451+win81" />
  <package id="NControl" version="0.9.1.0" targetFramework="portable46-net451+win81" />
  <package id="NControl.Controls" version="0.9.3.3" targetFramework="portable46-net451+win81" />
  <package id="Newtonsoft.Json" version="6.0.8" targetFramework="portable46-net451+win81" />
  <package id="NGraphics" version="0.4.0" targetFramework="portable46-net451+win81" />
  <package id="Rg.Plugins.Popup" version="1.0.4" targetFramework="portable46-net451+win81" />
  <package id="Splat" version="1.6.2" targetFramework="portable46-net451+win81" />
  <package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="portable46-net451+win81" />
  <package id="sqlite-net-pcl" version="1.1.2" targetFramework="portable46-net451+win81" />
  <package id="SQLitePCL.bundle_green" version="0.9.2" targetFramework="portable45-net45+win8+wp8+wpa81" />
  <package id="SQLitePCL.raw" version="0.9.2" targetFramework="portable45-net45+win8+wp8+wpa81" requireReinstallation="true" />
  <package id="System.Collections" version="4.3.0" targetFramework="portable46-net451+win81" />
  <package id="System.Data.Common" version="4.3.0" targetFramework="portable46-net451+win81" />
  <package id="System.Dynamic.Runtime" version="4.0.11" targetFramework="portable46-net451+win81" />
  <package id="System.Globalization" version="4.3.0" targetFramework="portable46-net451+win81" />
  <package id="System.IO" version="4.3.0" targetFramework="portable46-net451+win81" />
  <package id="System.Linq" version="4.1.0" targetFramework="portable46-net451+win81" />
  <package id="System.Reflection" version="4.1.0" targetFramework="portable46-net451+win81" />
  <package id="System.Reflection.Extensions" version="4.0.1" targetFramework="portable46-net451+win81" />
  <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="portable46-net451+win81" />
  <package id="System.Runtime" version="4.3.0" targetFramework="portable46-net451+win81" />
  <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="portable46-net451+win81" />
  <package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="portable46-net451+win81" />
  <package id="System.Threading" version="4.0.11" targetFramework="portable46-net451+win81" />
  <package id="System.Threading.Tasks" version="4.3.0" targetFramework="portable46-net451+win81" />
  <package id="Xamarin.Forms" version="2.5.0.122203" targetFramework="portable46-net451+win81" />
  <package id="XLabs.Core" version="2.0.5782" targetFramework="portable46-net451+win81" />
  <package id="XLabs.Forms" version="2.0.5782" targetFramework="portable46-net451+win81" />
  <package id="XLabs.IoC" version="2.0.5782" targetFramework="portable46-net451+win81" />
  <package id="XLabs.Platform" version="2.0.5782" targetFramework="portable46-net451+win81" />
  <package id="XLabs.Serialization" version="2.0.5782" targetFramework="portable46-net451+win81" />
  <package id="ZXing.Net.Mobile" version="2.4.1" targetFramework="portable46-net451+win81" />
  <package id="ZXing.Net.Mobile.Forms" version="2.4.1" targetFramework="portable46-net451+win81" />
</packages>

The 'HWebbuilder'-packages are custom private packages. They do not contain a reference to System.Web. I doublechecked it.

greenhoorn
  • 1,601
  • 2
  • 15
  • 39
  • Clean, rebuild, delete the bin and obj, restart VS. Maybe [dependencywalker](http://www.dependencywalker.com/) will give you some help. – Robbit Apr 25 '18 at 08:31
  • @JoeLv-MSFT Already did all of that, no changes. – greenhoorn Apr 25 '18 at 08:39
  • Please read [this](https://stackoverflow.com/a/21475455/8632294). Or please tell me what packages have you installed, I will have a try. – Robbit Apr 25 '18 at 08:51
  • @JoeLv-MSFT, there are many packages installed.. FluentValidation, ACR.UserDialogs, NControl, Splat, SQLite.Net, sqlite-net-pcl, XLabs, ZXing.Net to mention a few. See my updated question – greenhoorn Apr 26 '18 at 07:45
  • Is it a Xamarin.Android project? I will install the packages mentioned by you with VS 2017. – Robbit Apr 26 '18 at 07:54
  • It is a Xamarin.Forms project, profile44 – greenhoorn Apr 26 '18 at 07:57
  • @JoeLv-MSFT, I was able to fix the error. One of my own packages had a reference to System.Web, which I didn't see until I used ILSpy (great tool btw).... sorry for the troubles! – greenhoorn Apr 26 '18 at 08:42

1 Answers1

1

To anyone having similar problems, use ILSpy to analyze your assemblies! Great tool!

greenhoorn
  • 1,601
  • 2
  • 15
  • 39