简体   繁体   English

将 Visual Studio 2017 更新到版本 15.5.2 后出现 Xamarin 错误

[英]Xamarin error after updating Visual Studio 2017 to version 15.5.2

After updating my VS 2017 to the latest version, when I create a new Xamarin app it loads with errors.将我的 VS 2017 更新到最新版本后,当我创建一个新的 Xamarin 应用程序时,它加载了错误。 The surprising bit is that when I open an app created before I updated the IDE, it loads perfectly.令人惊讶的是,当我打开一个在我更新 IDE 之前创建的应用程序时,它可以完美加载。 Can anyone help?任何人都可以帮忙吗? Below are the errors:以下是错误:

Error   CS0012  The type 'AppCompatActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Error   CS0012  The type 'AppCompatActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Error   CS0012  The type 'AppCompatActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Error   CS0012  The type 'AppCompatActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Error   CS0012  The type 'AppCompatActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Error   CS0012  The type 'AppCompatActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Error   CS0012  The type 'AppCompatActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Error   CS0012  The type 'AppCompatActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Error   CS0012  The type 'AppCompatActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Error   CS0012  The type 'AppCompatActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Error   CS0012  The type 'AppCompatActivity' is defined in an assembly that is not referenced. You must add a reference to assembly 'Xamarin.Android.Support.v7.AppCompat, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Error   CS0103  The name 'InitializeComponent' does not exist in the current context    App2ButtonImages.iOS    D:\Kajambiya\2017\Xamarin\App2ButtonImages\App2ButtonImages\App2ButtonImages\App.xaml.cs    14  Active.
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)
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)               
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) 
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)
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)

I think at least the first errors speaks for it self, you need to add the nuget package我认为至少第一个错误不言自明,您需要添加 nuget 包

Xamarin.Android.Support.v7.AppCompat Xamarin.Android.Support.v7.AppCompat

The other errors point towards needing to build against a newer Android SDK, which you probably don't have installed.其他错误表明需要针对较新的 Android SDK 进行构建,您可能尚未安装该 SDK。

我已经从 NuGet 卸载了所有 AppCompatActivity 包,它对我有用

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM