问题
I am new to Xamarin. I have installed VisualStudio 2017 with Xamarin component and my android sdk is updated to Android (v6.0). I have created new Xamarin project and I am getting errors:
Severity Code Description Project File Line Suppression State
Warning The $(TargetFrameworkVersion) for Xamarin.Forms.Platform.dll(v7.1) is greater than the $(TargetFrameworkVersion) for your project (v6.0).
You need to increase the $(TargetFrameworkVersion) for your project. App2.Android C:\(PATH-TO-REPOS)\repos\App2\App2\App2.Android\App2.Android.csproj
I don't want to target (v7.1) please tell me where I can update the $(TargetFrameworkVersion)
for FormsViewGroup.dll
to target (v6.0).
There is already a similar question raise by someone here. But I didn't find any solution to decrease the version for FormsViewGroup.dll. Instead they suggested to update Android SDK But I don't want to target (v7.1).
Please suggest me the solution to update the $(TargetFrameworkVersion)
for FormsViewGroup.dll
to target (v6.0).
Thank you
回答1:
I encountered this problem and the only way I've found so far was to install Android 7.1.1 (API 25) in Android SDK manager and then in your Visual Studio Xamarin project go to project properties and in Application tab select "Use Latest Platform" from the combobox. then go to "Android Manifest" tab and set the target and minimum android version to whatever you want.
it seems that Xamarin in visual studio 2017 requires you to install the Android SDK 7.1 or above to get it to work correctly. though you can select your target android version a lower number and it will compile your application without any problems
回答2:
There are several reasons could explain this, you could try doing this :
- Solution One
Cleaned the temp folder, removed the : C:\Users\name\AppData\Local\Temp\MonoAndroid,Version=v6.0.AssemblyAttributes.cs
,
Msbuild state depends on temp files.
- Solution two
- Go to C:\Program Files (x86)\Android\android-sdk.
- run SDK Manager.exe.
- Click on Update the Packages. (It will download necessary updates)
- Go to Application properties
- Set the Target Android version(6 or 7 according to the error).
来源:https://stackoverflow.com/questions/45994419/how-to-decrease-targetframeworkversion-for-formsviewgroup-dll-from-v7-1-to