[英]Xamarin error after updating Visual Studio 2017 to version 15.5.2
將我的 VS 2017 更新到最新版本后,當我創建一個新的 Xamarin 應用程序時,它加載了錯誤。 令人驚訝的是,當我打開一個在我更新 IDE 之前創建的應用程序時,它可以完美加載。 任何人都可以幫忙嗎? 以下是錯誤:
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)
我認為至少第一個錯誤不言自明,您需要添加 nuget 包
Xamarin.Android.Support.v7.AppCompat
其他錯誤表明需要針對較新的 Android SDK 進行構建,您可能尚未安裝該 SDK。
我已經從 NuGet 卸載了所有 AppCompatActivity 包,它對我有用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.