1

I upgraded my Visual Studio version to 15.5.2 last night. Now I can no longer run Xamarin.Forms cross platform apps. They were working fine with no errors before.

When I create a project the option for .NET Portable Class Library is no longer available, and has been replaced with the .NET standard library option.

enter image description here

enter image description here

However the template project that visual studio creates doesn't work. It gives me all these errors. I don't know what to do to fix this, I tried installing the latest .NET Core SDK based on this answer

https://stackoverflow.com/a/45737766

but it had no effect.

1.

Severity Code Description Project File Line Suppression State Error The current .NET SDK does not support targeting .NET Standard 2.0. Either target .NET Standard 1.6 or lower, or use a version of the .NET SDK that supports .NET Standard 2.0. Phoneword C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.TargetFrameworkInference.targets 126

2.

Severity Code Description Project File Line Suppression State Error The "ResolveLibraryProjectImports" task failed unexpectedly. System.IO.FileNotFoundException: Could not load assembly 'Phoneword, Version=0.0.0.0, Culture=neutral, PublicKeyToken='. Perhaps it doesn't exist in the Mono for Android profile? File name: 'Phoneword.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, ICollection1 jars, ICollection1 resolvedResourceDirectories, ICollection1 resolvedAssetDirectories, ICollection1 resolvedEnvironments) at Xamarin.Android.Tasks.ResolveLibraryProjectImports.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() Phoneword.Android

.

EDIT: The following 4 errors (3 - 7) went away after I installed the Android 8 SDK from the Android SDK manager, then selected it in the 'Compile using Adnroid Version' option'

enter image description here

3.

Error NU1202 Package Xamarin.Android.Support.v4 25.4.0.2 is not compatible with monoandroid60 (MonoAndroid,Version=v6.0). Package Xamarin.Android.Support.v4 25.4.0.2 supports: monoandroid70 (MonoAndroid,Version=v7.0)

4.

Error NU1202 Package Xamarin.Android.Support.v7.CardView 25.4.0.2 is not compatible with monoandroid60 (MonoAndroid,Version=v6.0). Package Xamarin.Android.Support.v7.CardView 25.4.0.2 supports: monoandroid70 (MonoAndroid,Version=v7.0)

5.

Error NU1202 Package Xamarin.Android.Support.v7.AppCompat 25.4.0.2 is not compatible with monoandroid60 (MonoAndroid,Version=v6.0). Package Xamarin.Android.Support.v7.AppCompat 25.4.0.2 supports: monoandroid70 (MonoAndroid,Version=v7.0)

6.

Error NU1202 Package Xamarin.Android.Support.v7.MediaRouter 25.4.0.2 is not compatible with monoandroid60 (MonoAndroid,Version=v6.0). Package Xamarin.Android.Support.v7.MediaRouter 25.4.0.2 supports: monoandroid70 (MonoAndroid,Version=v7.0)

7.

Error NU1202 Package Xamarin.Android.Support.Design 25.4.0.2 is not compatible with monoandroid60 (MonoAndroid,Version=v6.0). Package Xamarin.Android.Support.Design 25.4.0.2 supports: monoandroid70 (MonoAndroid,Version=v7.0)

erotavlas
  • 4,274
  • 4
  • 45
  • 104
  • 1
    Open command prompt and navigate to the folder `Phoneword`. Run `dotnet --version` to see what exactly is the .NET Core SDK on your machine. I cannot reproduce the error at all (but another related to Xamarin.Android). – Lex Li Dec 28 '17 at 23:46
  • @LexLi the command output is .NET Command Line Tools (1.0.0-beta-001598) – erotavlas Dec 29 '17 at 02:28
  • Clearly that's the culprit. People should use 2.x (2.1.2 for example) today, while you are using a 1.0.0 beta release (years old). Go to http://dot.net and download the latest SDK installer. – Lex Li Dec 29 '17 at 02:29
  • @LexLi I went to the control panel and saw I have installed 1.0.0 as well as 1.0.3, and 2.1.2, and 2.1.3...so I'm going to try your suggestion but will uninstall all of them and reinstall just the latest one to see if that helps. – erotavlas Dec 29 '17 at 02:32
  • Then check the folders to see if you have `global.json` left somewhere by mistake. If such a file exists and forces its sub directories to use the out-of-date SDK version, no doubt you won't get things done. – Lex Li Dec 29 '17 at 02:34
  • @LexLi the uninstall/reinstall was unsuccessful, tried creating brand new project but the first two errors persist. I checked the entire solution directory for global.json file but none exists. These are Microsoft generated project, I doubt they would have left that in there. – erotavlas Dec 29 '17 at 02:39
  • I said clearly a `global.json` would affect all sub directories, so **don't just look at your solution directory and analyze its parents**. Find it and remove it. Of course, if you really want to keep that, add a new `global.json` in your solution directory and set SDK version in it to something like 2.1.3. – Lex Li Dec 29 '17 at 02:42
  • @LexLi The only instance I found on my entire machine was located in "..AppData\Roaming\npm\node_modules\vs-tac\node_modules\edge\node_modules\edge-cs\src\edge-cs-coreclr" and although unlikely visual studio would be reaching all the way into that folder to read this file, I renamed it anyway and tried creating a new project after restarting VS, but no success. – erotavlas Dec 29 '17 at 03:07

2 Answers2

2

I noticed the target framework in the shared project settings was blank, probably targeting .NET standard library 2.0 which I think is not compatible with this project type.

enter image description here

enter image description here

I selected version 1.6 and after I did that the yellow warning symbol in the dependencies went away and a new dependency appeared for the .NET standard library SDK

enter image description here

erotavlas
  • 4,274
  • 4
  • 45
  • 104
1

Try to change "Compile using Android Version" to 7.0 or 8.0 under Android project -> properties -> Application.

lukhol
  • 318
  • 2
  • 6
  • 18
  • Ok well I installed Oreo 8.0 through the SDK manager and then switched to that in the Android project properties. It solved errors 3 - 7, but the first two errors still persist. – erotavlas Dec 28 '17 at 22:40
  • 2. Your Android project probably does not reference to shared code project. Right click on Reference under Android project -> Add reference... and add reference to the Phoneword. – lukhol Dec 28 '17 at 23:19
  • Try to remove this reference, clean project, restart visual studio and add reference again. – lukhol Dec 28 '17 at 23:25