Skip to content

Commit df27cbb

Browse files
[main] Avoid "missing toolset" error in design-time builds (dotnet#42396)
Co-authored-by: Jan Jones <janjones@microsoft.com>
1 parent 648e1b0 commit df27cbb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ Copyright (c) .NET Foundation. All rights reserved.
250250
Condition="'@(PackageReference->AnyHaveMetadataValue('Identity', 'Microsoft.Net.Compilers.Toolset.Framework'))' == 'true'" />
251251
</Target>
252252

253-
<Target Name="_CheckMicrosoftNetSdkCompilersToolsetPackageExists" Condition="'$(_NeedToDownloadMicrosoftNetSdkCompilersToolsetPackage)' == 'true'" BeforeTargets="CoreCompile">
253+
<Target Name="_CheckMicrosoftNetSdkCompilersToolsetPackageExists"
254+
Condition="'$(_NeedToDownloadMicrosoftNetSdkCompilersToolsetPackage)' == 'true' and '$(DesignTimeBuild)' != 'true'"
255+
BeforeTargets="CoreCompile">
254256
<!-- If users did not run restore or it failed to download the Microsoft.Net.Sdk.Compilers.Toolset package
255257
(but they proceeded to build, e.g., in Visual Studio), display an error with suggestions how to fix the problem. -->
256258
<NETSdkError ResourceName="MicrosoftNetSdkCompilersToolsetNotFound"

0 commit comments

Comments
 (0)