24

We are running the 'Welcome to Xamarin` example on Visual Studio Enterprise, using the latest Xamarin, in a Windows 8.1 environment.

We are managing to build and run on both Windows and Apple, but we are facing problems with Android.

Error: The referenced component System.ObjectModel could not be found.

The errors can be seen in the screen shot below:

See screenshot

We've already tried searching online for solutions, we found some, which we tried, but to no avail.

On the other hand, is Xamarin compatible with Windows 8.1? Perhaps some Android requirement actually needs a Windows 10 environment.

Any help would be appreciated.

Neil Camilleri
  • 243
  • 1
  • 3
  • 6
  • 6
    Please don't post errors as screenshots - these are not indexable by search engines. Take the time to post the text of the error message. – Jason Jul 08 '16 at 15:38
  • 1
    Xamarin and Visual Studio are so frustrating. Brand new solution, update xamarin forms, and out of the box you get this warning. I literally had to manually resolve this reference by adding the dll from: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ObjectModel.dll. I'm very much second-guessing myself for trying Xamarin... – Jason Jul 21 '16 at 21:38
  • @Jason I am missing the MonoAndroid folder, have I missed a step somewhere? – Professor of programming Oct 18 '17 at 14:34
  • @Bonner웃 Unfortunately (or fortunately) I'm no longer actively developing with Xamarin...so I'm no longer dealing with the numerous xamarin issues or setup to answer your question, sorry! – Jason Oct 20 '17 at 08:16

7 Answers7

20

Right click on your Android project's references and manually add the reference: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ObjectModel.dll. And technically that's a warning, not an error.

Jason
  • 2,579
  • 1
  • 17
  • 19
  • I do this but i the warning is still there. – Jon Aug 30 '16 at 08:52
  • @Jon make sure the dll path is correct and readable (security permissions). If that fails, look at your .csproj specifically looking for invalid paths to any nuget packages. Last think I can think of is make sure you're fully up-to-date (VS, Xamarin, Xamarin Studio on your mac, everything). I haven't seen this error in quite a while. – Jason Sep 03 '16 at 21:40
  • 1
    I have VS and Xamarin updated, the Facades folder and System.ObjectModel.dll have alowed read and run. And there aren't invalid paths in the .csproj file. – Jon Sep 05 '16 at 10:58
  • 1
    Same for me. I just went to the folder, checked permissions, and they are as you described, as well as for all other DLLs. BUT, for this one, even after manually adding it back, I have this "could not be found error". I am prettu sure that, if I were to run VS as administrator, it would work, but that does not feels right. – BernardG Sep 05 '16 at 11:08
  • 6
    Hum.. I moved the dll to the solution Packages directory, deleted it from the project references, and added it back, and this time if works. I may be wrong, but I have a hunch the csproj does not like the space in "Program Files". All the other assemblies are referenced from "packages" without any space in the path definition. – BernardG Sep 05 '16 at 11:24
  • I haven't seen this error in quite some time. If anyone sees it and has that code available (e.g. github) I'm happy to take a look. Other than BernardGs comment I haven't seen any evidence that paths in the spaces are the culprit. I like the simplicity of hvaughan3's solution! All in all this feels like sporadic Visual Studio and/or Xamarin nonsense. – Jason Sep 06 '16 at 13:11
  • @BernardG, your "packages" solution worked for me. I was working with the Microsoft DevDays Xamarin labs. – EnocNRoll - AnandaGopal Pardue Nov 05 '16 at 17:34
  • I had the problem in VS2017RC, – 27k1 Jan 06 '17 at 17:34
  • I just did a fresh install of VS 2017 Preview and I'm having this issue. – Post Impatica May 17 '17 at 14:48
  • A couple points I have noticed. First, the location for the reference seems to have changed in a recent release of Visual Studio 2017. The new directory is: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ObjectModel.dll Second, even after adding it, and even after trying to run VS as an administrator, I still get the same warning, and it does not allow me to enable that reference. Has it been deprecated or something, or am I just doing something wrong? – Derik Taylor Aug 13 '17 at 19:08
13

I simply removed the reference entirely since none of my code actually used it.

hvaughan3
  • 10,955
  • 5
  • 56
  • 76
  • Just so others know, this dll contains interfaces like INotifyPropertyChanged and ICommand so I can't remove it. – Post Impatica May 17 '17 at 14:42
  • 3
    @Helzgate You can remove it from your Xamarin.Android project if you do not use `INotifyPropertyChanged` and `ICommand` within your Xamarin.Android project, which I do not. I only use those classes in my PCL project and removing it from my Xamarin.Android project has had no bad effects so far. – hvaughan3 May 17 '17 at 14:50
6

In the Package manager console type: (Select the Android project)

update-package -reinstall

Is slower but is the correct method and always works

Dorathoto
  • 201
  • 7
  • 17
1

Exercise 1 from GitHub https://github.com/XamarinUniversity/XAM135/ when opening has the same problem.

Based on the above solutions I resolved by performing the following steps:

  1. Update the Nuget Package

  2. Save, close and abire the solution

  3. Click on the Portable (shared) project-> Referencias-> Donet in the copy properties of the path = "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5\Profile\Profile111"

  4. Open Windows Explorer and paste the path = "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5\Profile\Profile111", here is the System.ObjectModel.dll file

  5. Click on the Droid Project -> Referencias and REMOVE System.ObjectModel

  6. Right click on References and Add references

  7. Click the Browse button and open the path = "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETPortable\v4.5\Profile\Profile111"

  8. Select System.ObjectModel.dll, and then click Add and OK

  9. The reference was added successfully! Save, compile the project.

Here is a similiar solution

Samir Morimoto
  • 189
  • 2
  • 4
0

Try moving it to desktop, then add it as ref in solution. worked for me, visual studio had access to all the other ref but for some reason dident have access to that specific ref. So i moved it, and i think it gave visual studio access. simply try to move it where access wont be a problem.

Aj_Uthaya
  • 23
  • 4
0

Copy dll and paste to packages folder. Change reference to new location and run project. Of course it's temporary solution. You can check another location for path without white spaces in folders name. ovee

ovee
  • 1
0

yes, you are partially correct, it works, but after again giving to old location (C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\MonoAndroid\v1.0\Facades\System.ObjectModel.dll) missing error resolved.