Bug 60181 - MSBuild tasks should provide a consistent way to determine the installed xamarin version
Summary: MSBuild tasks should provide a consistent way to determine the installed xama...
Status: RESOLVED ANSWERED
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 8.0 (15.4)
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: dean.ellis
URL:
Depends on:
Blocks:
 
Reported: 2017-10-13 16:14 UTC by Jerome Laban
Modified: 2017-10-13 17:44 UTC (History)
2 users (show)

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

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 Jerome Laban 2017-10-13 16:14:28 UTC
In VS2017 15.4, the current Xamarin.Android version file changed from :

 $(MSBuildExtensionsPath)\Xamarin\Android\Version

to 

 $(MSBuildExtensionsPath)\Xamarin\Android\Version.txt

Since there is no other way to get this version, I'm using this file to enable or disable features based its content (such as requiring specific features like Concurrent SGen).

Xamarin.Android and Xamarin.iOS should provide a consistent way to get the currently running version, either via a known file, or an msbuild variable.
Comment 1 Jon Douglas [MSFT] 2017-10-13 16:36:19 UTC
Have you tried using $(XamarinAndroidVersion)?

Here's a quick example:

<Target Name="BeforeBuild">
      <Message Text="Xamarin.Android Version = $(XamarinAndroidVersion)" />  
</Target>

You might then see:

1>Task "Message" (TaskId:64)
1>  Task Parameter:Text=Xamarin.Android Version = 8.1.0-19 (TaskId:64)
1>  Xamarin.Android Version = 8.1.0-19 (TaskId:64)
1>Done executing task "Message". (TaskId:64)
Comment 2 Jerome Laban 2017-10-13 17:20:33 UTC
Thanks Jon, that's great to see that it's in the latest preview :)

I was mentioning iOS as well, and I did not find this for iOS. Should I open a bug for iOS ?
Comment 3 Jon Douglas [MSFT] 2017-10-13 17:27:54 UTC
(In reply to Jerome Laban from comment #2)
> Thanks Jon, that's great to see that it's in the latest preview :)
> 
> I was mentioning iOS as well, and I did not find this for iOS. Should I open
> a bug for iOS ?

Hi Jerome,

This has been available since about June. It should also be included in the current Stable. My test was done on a Preview instance as that's the one I had open at the time :)

https://github.com/xamarin/xamarin-android/commit/74f1bd64aa53dcbbbd983f75b032044d237d4239#diff-dd33717a50863f225641c5b08ddbd2f9

As for the iOS equivalent, please create a bug in the iOS product. From a quick glance at their properties, I do not see one. However they will know better than myself.

https://github.com/xamarin/xamarin-macios/blob/master/msbuild/Xamarin.iOS.Tasks.Core/Xamarin.iOS.Common.props
Comment 4 Jerome Laban 2017-10-13 17:44:57 UTC
Thanks! Will open a new one then.