Skip to content

Commit

Permalink
Rely on CommonTargetsPath to detect unknown TargetFramework
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Sep 27, 2019
1 parent f907e76 commit 5a6b1f3
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,16 @@
<_SdkLanguageTargetsMissing Condition="'$(_SdkLanguageTargetsMissing)' == ''">true</_SdkLanguageTargetsMissing>
</PropertyGroup>

<!-- Check if the Common targets have been loaded, see https://github.com/onovotny/MSBuildSdkExtras/pull/186 -->
<!-- https://github.com/microsoft/msbuild/blob/d42d3504057ef2b88dd4f68c4bfc5591371bd6fe/src/Tasks/Microsoft.Common.targets#L32-L43 -->
<PropertyGroup Condition=" '$(CommonTargetsPath)' == '' Or '$(MSBuildVersion)' &gt;= '16.0' ">
<_SdkLanguageTargetsMissing Condition="'$(CommonTargetsPath)'!=''">false</_SdkLanguageTargetsMissing>
<_SdkLanguageTargetsMissing Condition="'$(_SdkLanguageTargetsMissing)' == ''">true</_SdkLanguageTargetsMissing>
</PropertyGroup>

<!-- Check to see if the Lang targets exist and if not, trigger an error on Compile -->
<!-- We clear out the lang targets so the defaults are used for the error to show -->
<PropertyGroup Condition="'$(_ExtrasSkipTargetsCheck)' != 'true' ">
<PropertyGroup Condition="'$(_ExtrasSkipTargetsCheck)' != 'true' and '$(_SdkLanguageTargetsMissing)' == 'true' ">

<!-- Reset LanguageTargets Eval-->
<!-- https://github.com/dotnet/sdk/blob/581f5371dac022ad2b3e5bcdbb2e576bd73b5c4a/src/Tasks/Microsoft.NET.Build.Tasks/sdk/Sdk.targets#L28-L37 -->
Expand All @@ -30,7 +37,7 @@

<!-- Import common targets so NuGet restore succeeds -->
<!-- https://github.com/dotnet/sdk/blob/979eed136b786b6e2d77f567eb5a368952982740/src/Tasks/Microsoft.NET.Build.Tasks/sdk/Sdk.targets#L33 -->
<Import Project="$(LanguageTargets)" />
<Import Condition=" '$(_SdkLanguageTargetsMissing)' == 'true' " Project="$(LanguageTargets)" />


<Target Name="_ShowMissingLanguageTargetsError" BeforeTargets="_CheckForUnsupportedTargetFramework" Condition="'$(_SdkLanguageTargetsMissing)' == 'true' and '$(_SdkIgnoreMissingLanguageTargetsError)' != 'true' ">
Expand Down

0 comments on commit 5a6b1f3

Please sign in to comment.