Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[msbuild] Preserve overriden values and only override on VS2017+ #1

Merged
merged 1 commit into from
Apr 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ Copyright (C) 2011-2016 Xamarin. All rights reserved.
-->
<Project InitialTargets="RedirectMonoAndroidSdkPaths;RemoveSdksCache" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<PropertyGroup Condition="'$(VsInstallRoot)' != ''">
<!-- Grab InstallationID from devenv.ini.isolation's InstallationID=[ID] -->
<DevEnvIni>$([System.IO.File]::ReadAllText('$(VsInstallRoot)\Common7\IDE\devenv.isolation.ini'))</DevEnvIni>
<InstallationIDEqualsIndex>$(DevEnvIni.IndexOf('InstallationID='))</InstallationIDEqualsIndex>
<InstallationIDEqualsIndex>$([MSBuild]::Add('$(InstallationIDEqualsIndex)', '15'))</InstallationIDEqualsIndex>
<VsInstallationID>$(DevEnvIni.Substring($(InstallationIDEqualsIndex), 8))</VsInstallationID>
</PropertyGroup>

<PropertyGroup>
<PropertyGroup Condition="'$(VsInstallRoot)' != ''">
<!-- Until VS2017+ includes its own ReferenceAssemblies outside of C:\Program Files (x86)\Reference Assemblies and into
the VsInstallRoot, we must override this ourselves for our SDKs -->
<TargetFrameworkRootPath>$(VsInstallRoot)\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\</TargetFrameworkRootPath>
<FrameworkPathOverride>$(TargetFrameworkRootPath)MonoAndroid\v1.0</FrameworkPathOverride>
<TargetFrameworkRootPath Condition="'$(TargetFrameworkRootPath)' == ''">$(VsInstallRoot)\Common7\IDE\ReferenceAssemblies\Microsoft\Framework\</TargetFrameworkRootPath>
<FrameworkPathOverride Condition="'$(FrameworkPathOverride)' == ''">$(TargetFrameworkRootPath)MonoAndroid\v1.0</FrameworkPathOverride>
<XamarinAndroidSdkPropsImported>true</XamarinAndroidSdkPropsImported>
</PropertyGroup>

<Target Name="RedirectMonoAndroidSdkPaths">
<Target Name="RedirectMonoAndroidSdkPaths" Condition="'$(VsInstallRoot)' != ''">
<PropertyGroup>
<MonoAndroidToolsDirectory Condition=" '$(MonoAndroidToolsDirectory)' == '' ">$(VsInstallRoot)\MSBuild\Xamarin\Android</MonoAndroidToolsDirectory>
<MonoAndroidBinDirectory Condition=" '$(MonoAndroidBinDirectory)' == '' ">$(VsInstallRoot)\MSBuild\Xamarin\Android</MonoAndroidBinDirectory>
Expand All @@ -40,7 +40,7 @@ Copyright (C) 2011-2016 Xamarin. All rights reserved.
<Delete Files="$(IntermediateOutputPath)sdks.cache" />
</Target>

<UsingTask TaskName="SetVsMonoAndroidRegistryKey" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<UsingTask Condition="'$(VsInstallRoot)' != ''" TaskName="SetVsMonoAndroidRegistryKey" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<InstallationID Required="true" />
<VisualStudioVersion Required="true" />
Expand Down