Skip to content
Permalink
Browse files

[Build] Check Visual C++ Runtime is properly installed as part of bui…

…ld targets
  • Loading branch information
xen2 committed Nov 20, 2018
1 parent aab0909 commit 47f326f76a4d1cb120f6954c9c134cc393b33544
@@ -1,4 +1,24 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Check if Visual C++ Runtime 2013 is properly installed -->
<!-- Should be moved to Xenko.Assets as soon as transitive build dependencies are enabled by default in VS2019 (https://github.com/NuGet/Home/issues/6091#issuecomment-438073285) -->
<Target Name="_XenkoCheckVisualCRuntime2013">
<ItemGroup>
<_XenkoVisualCRuntime2013 Include="Visual C++ Redistributable for Visual Studio 2013 x86">
<Version>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VC\Servicing\12.0\RuntimeMinimum', 'Version', null, RegistryView.Registry32))</Version>
<ExpectedVersion>12.0.21005</ExpectedVersion>
<DownloadUrl>http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x86.exe</DownloadUrl>
</_XenkoVisualCRuntime2013>
<_XenkoVisualCRuntime2013 Include="Visual C++ Redistributable for Visual Studio 2013 x64">
<Version>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VC\Servicing\12.0\RuntimeMinimum', 'Version', null, RegistryView.Registry64))</Version>
<ExpectedVersion>12.0.21005</ExpectedVersion>
<DownloadUrl>http://download.microsoft.com/download/2/E/6/2E61CFA4-993B-4DD4-91DA-3737CD5CD6E3/vcredist_x64.exe</DownloadUrl>
</_XenkoVisualCRuntime2013>

<_XenkoVisualCRuntime2013NotInstalled Include="@(_XenkoVisualCRuntime2013)" Condition="'%(_XenkoVisualCRuntime2013.Version)' == '' Or $([System.Version]::Parse('%(Version)').CompareTo($([System.Version]::Parse('%(_XenkoVisualCRuntime2013.ExpectedVersion)')))) &lt; 0" />
</ItemGroup>

<Error Condition="'@(_XenkoVisualCRuntime2013NotInstalled)' != ''" Text="@(_XenkoVisualCRuntime2013NotInstalled->'%(Identity) is not installed. Please download from %(DownloadUrl)', '%0a')"/>
</Target>
<!--
*****************************************************************************************************************************
Compile Asset
@@ -1,4 +1,4 @@
<Project InitialTargets="XenkoCheckRequirements" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project InitialTargets="XenkoCheckRequirements;_XenkoCheckVisualCRuntime2015" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Check requirements when running this build file -->
<Target Name="XenkoCheckRequirements">
<Error Condition="'$(XenkoPlatform)' == ''" Text="The property %24(XenkoPlatform) must be defined by the project"/>
@@ -12,6 +12,25 @@
<Output TaskParameter="TargetOutputs" PropertyName="CurrentSolutionConfigurationContents"/>
</MSBuild>
</Target>
<!-- Check if Visual C++ Runtime 2015 is properly installed -->
<Target Name="_XenkoCheckVisualCRuntime2015">
<ItemGroup>
<_XenkoVisualCRuntime2015 Include="Visual C++ Redistributable for Visual Studio 2015 x86">
<Version>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VC\Servicing\14.0\RuntimeMinimum', 'Version', null, RegistryView.Registry32))</Version>
<ExpectedVersion>14.0.23026</ExpectedVersion>
<DownloadUrl>http://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe</DownloadUrl>
</_XenkoVisualCRuntime2015>
<_XenkoVisualCRuntime2015 Include="Visual C++ Redistributable for Visual Studio 2015 x64">
<Version>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VC\Servicing\14.0\RuntimeMinimum', 'Version', null, RegistryView.Registry64))</Version>
<ExpectedVersion>14.0.23026</ExpectedVersion>
<DownloadUrl>http://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x64.exe</DownloadUrl>
</_XenkoVisualCRuntime2015>

<_XenkoVisualCRuntime2015NotInstalled Include="@(_XenkoVisualCRuntime2015)" Condition="'%(_XenkoVisualCRuntime2015.Version)' == '' Or $([System.Version]::Parse('%(Version)').CompareTo($([System.Version]::Parse('%(_XenkoVisualCRuntime2015.ExpectedVersion)')))) &lt; 0" />
</ItemGroup>

<Error Condition="'@(_XenkoVisualCRuntime2015NotInstalled)' != ''" Text="@(_XenkoVisualCRuntime2015NotInstalled->'%(Identity) is not installed. Please download from %(DownloadUrl)', '%0a')"/>
</Target>

<!--
*****************************************************************************************************************************

0 comments on commit 47f326f

Please sign in to comment.
You can’t perform that action at this time.