Bug 56857 - Opening project gives errors about Android 7.0 even though it was changed to Android 6.0
Summary: Opening project gives errors about Android 7.0 even though it was changed to ...
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 7.3 (15.2)
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2017-05-25 23:46 UTC by Mark McLemore
Modified: 2017-06-23 18:21 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
First screenshot (23.12 KB, image/png)
2017-05-25 23:46 UTC, Mark McLemore
Details
Second screenshot (20.65 KB, image/png)
2017-05-25 23:47 UTC, Mark McLemore
Details
System info (1.21 KB, text/plain)
2017-05-25 23:48 UTC, Mark McLemore
Details
Third screenshot (build warnings) (9.49 KB, image/png)
2017-05-25 23:53 UTC, Mark McLemore
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Mark McLemore 2017-05-25 23:46:40 UTC
Created attachment 22470 [details]
First screenshot

I downloaded the FlashCardPager sample (https://developer.xamarin.com/samples/monodroid/UserInterface%5CFlashCardPager/) and opened it in Visual Studio 2017 Enterprise (15.2). It get the following (expected) error:

  Project FlashCardPager cannot build using Android 7.0 (API Level 24 - Nougat) because Android
  SDK Platform for API Level is not installed ... (see screenshot-1.png).

This makes sense because this sample project was saved at 7.0:

  <TargetFrameworkVersion>v7.0</TargetFrameworkVersion>

Next, I changed the Minimum and Target Android versions to Android 6.0 (API Level 23), saved the changes, 
exited and restarted Visual Studio. 

However, when I try to open the project again, it still reports the Android 7.0 error 
(see screenshot-2.png). I should not get this error because the Target Android version
is now set to Android 6.0 (as shown in the screenshot).

It looks like the .csproj file is not being updated during the save -- it still shows:

   <TargetFrameworkVersion>v7.0</TargetFrameworkVersion>
Comment 1 Mark McLemore 2017-05-25 23:47:40 UTC
Created attachment 22471 [details]
Second screenshot
Comment 2 Mark McLemore 2017-05-25 23:48:05 UTC
Created attachment 22472 [details]
System info
Comment 3 Mark McLemore 2017-05-25 23:52:40 UTC
As a workaround, I can use vim to edit the .csproj file and change the TargetFrameworkVersion to "v6.0" -- after that, opening the project in Visual Studio no longer gives me the error.  Build succeeds, but with warnings (shown in the third screenshot).
Comment 4 Mark McLemore 2017-05-25 23:53:47 UTC
Created attachment 22473 [details]
Third screenshot (build warnings)
Comment 5 Jon Douglas [MSFT] 2017-06-23 18:21:11 UTC
(In reply to Mark McLemore from comment #3)
> As a workaround, I can use vim to edit the .csproj file and change the
> TargetFrameworkVersion to "v6.0" -- after that, opening the project in
> Visual Studio no longer gives me the error.  Build succeeds, but with
> warnings (shown in the third screenshot).

These two options do not affect the "TargetFrameworkVersion". You need to change the "Compile using Android version (Target FramewroK) option to get rid of this error message:

http://i.imgur.com/IMGKHL9.png

I am marking this as RESOLVED ANSWERED for the time being. Please reopen this bug if it happens when changing the option above and the reflected value is not changed in the .csproj when saving and closing the project.

Target Android version != Target Framework Version (Yes...Super confusing, thank google!)