Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IDE0006 warning and many others on new Cross Platform Xamarin app with a fresh install of Visual Studio

I just installed Visual Studio 2017 on a PC running Windows 10, and created a Cross Platform Xamarin app (Blank and PLC) called "trial". Right off the bat, the following warning came up in the Errors box:

IDE0006 - Error encountered while loading the project. Some project pfeatures, such as full solution alaysisis for the failed project and projects that depend on it, have been disabled.

To see what caused the issue, please try below.

1. Close Visual Studio
2. Open a Visual Studio Developer Command Prompt
3. Set environment variable "TraceDesignTime" to true (set TraceDesignTime=true)
4. Delete .vs directory/.suo file
5. Restart VS from the command prompt you set the environment variable (devenv)
6. Open the solution
7. Check 'C:\Users\Me\AppData\Local\Temp\\trial.Android_*.designtime.log' and look for the failed tasks (FAILED)

Since then, I've tried creating many other apps, all of which start with at least that warning, and usually more. Searching for the other errors yields no results - searching for the IDE0006 one yields this and a few suggestions to update packages, but I tried all of them, including various combinations of updating/reinstalling/using previous versions of packages, deleting the "System.ObjectModel" reference, restarting, cleaning, and rebuilding, and the errors are still there. I even tried uninstalling and reinstalling Visual Studio, but nothing changed.

Weirder still, when I run my Android project despite the errors, nothing happens. On my first install of Visual Studio, an Android emulator popped up - the screen was completely black which I doubt is expected behavior but at least the emulator was there - but ever since the reinstall, nothing at all happens, and all errors and warnings just disappear from the Error box, so the box is totally empty (although the top bar still displays "1 Warnings"), and I can't get them to come back. I set up my Android project exactly as prescribed here.

I started to follow the 7 steps outlined in the error, but I couldn't find any ".vs" directory or ".suo" file, and then it occurred to me that I didn't know what I was doing and I didn't want to risk screwing up Visual Studio even further (I can't find any references to the 7 steps on Google and they also contain misspellings, so they feel outdated/sketchy). Anyone have any experience/insight on these steps?

Here are some of the other warnings that keep popping up - I assume/hope that all the warnings are caused by the same fundamental error, but I can't find any record of anyone else encountering any but the one above.

Cannot resolve Assembly or Windows Metadata file 'System.Runtime.dll'   trial.UWP   C:\Users\User\source\repos\trial\trial\trial.UWP\trial.UWP.csproj

Type universe cannot resolve assembly: System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=jf98hs8fsihso9. trial.UWP

Could not load assembly 'trial, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?   trial.Android

The "ResolveLibraryProjectImports" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load assembly 'trial, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'trial.dll'
   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
   at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve(String fullName)
   at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Extract(DirectoryAssemblyResolver res, ICollection`1 jars, ICollection`1 resolvedResourceDirectories, ICollection`1 resolvedAssetDirectories, ICollection`1 resolvedEnvironments)
   at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() trial.Android   

I've been tearing my hair out over this. I was really looking forward to learning Xamarin but I literally haven't been able to code a single line yet. What could be going on?? It's like my install is corrupted or something, but I don't see how that is possible, especially since I downloaded it twice, from the official site.


UPDATE

I tried the solution given here, namely building the Android project, unloading it then reloading it. All my warnings disappeared when I built it, but when I unloaded it I got this single error (which has appeared sporadically before), which remained.

The referenced component 'System.ObjectModel' could not be found.

(I've already removed "System.ObjectModel" from the list of references, which worked once on that error, but since then it's recurred). When I ran the app, it said "There were deployment errors, would you like to continue?" like it always does, I clicked "yes", and once again nothing happened. The single warning remained, even when the build the Android project again.


UPDATE 2

I created a new project and uploaded it to Github to demonstrate the problem: https://github.com/joeymorano/newfailure


UPDATE 3

I tried:

1.) Cleaning
2.) Deleting all `bin` and `obj` files 
3.) Rebuilding

but I still have errors. To be sure, I created a new project and tried the same steps, and three errors went away, but there's still the IDE0006 error. I uploaded that project too: https://github.com/joeymorano/stack


UPDATE 4

I still have the following errors this app: https://github.com/joeymorano/newfailure

Error   CS0103  The name 'InitializeComponent' does not exist in the current context


Warning     The referenced component 'System.ObjectModel' could not be found.       

Here's the Build Diagnostics, with the build verbosity set to Normal (it was too long to post here so I made a Google doc - Warning, it really is ridiculously long): https://docs.google.com/document/d/1qUJDdjNNOBqhS_Sp9pvH6ipLx67l5fgskRX4ltluxM8/edit?usp=sharing

like image 355
Joe Morano Avatar asked Nov 07 '17 01:11

Joe Morano


1 Answers

Do the following steps :

    1. Clean your solution
    1. Delete the bin and obj folder
    1. Reopen your Visual Studio and rebuild again.

I have test your project on my side, it works fine.

The referenced component 'System.ObjectModel' could not be found.

This is just a warning, not an error. You can remove it from your Xamarin.Android project if you do not use INotifyPropertyChanged and ICommand within your Xamarin.Android project.

Update :

Open your solution

When you deploy your Xamarin.Android project on emulator, you need to do some configuration. If you use a arm architecture emulator, it will very slow, it is recommended to use x86 architecture emulator, for example :

enter image description here

When you use a x86 architecture emulator, you need enable the Hardware Acceleration.

You could try using your Xamarin.UWP project, right click on your Stack.UWP, choose Set as StartUp Project,

enter image description here

Then deploy the Stack.UWP on your Location Machine. If this has no problem, I think you need to post the complete Xamarin.Android deploy errors, so we could help you pinpoint the problem.


Update 2 :

Right click on your project solution, open the Manage Nuget Packages for solution, update the Xamarin.Forms package to the latest version. Then clean your solution, delete the bin & obj folder and restart you VS again.

like image 54
York Shen Avatar answered Nov 15 '22 19:11

York Shen