Skip to content

Commit 3cb6722

Browse files
committed
guardrail to prevent use from unsupported SDK
1 parent 3480096 commit 3cb6722

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Microsoft.NET.Build.Containers/build/Microsoft.NET.Build.Containers.targets

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<Project>
2+
<Target Name="_ContainerVerifySDKVersion">
3+
<PropertyGroup>
4+
<_IsAllowedVersion Condition="$(NETCoreSdkVersion.StartsWith('7.0.100-preview.7')) or $(NETCoreSdkVersion.StartsWith('7.0.100-rc')) or $(NETCoreSdkVersion.StartsWith('7.0.100'))">true</_IsAllowedVersion>
5+
</PropertyGroup>
6+
<Error Code="CONTAINER002" Text="The current .NET SDK \($(NETCoreSdkVersion)\) doesn't support containerization. Please use version 7.0.100-preview.7 or higher." />
7+
</Target>
8+
29
<Target Name="ComputeContainerConfig">
310
<!-- Reference data about this project -->
411
<PropertyGroup>
@@ -58,6 +65,7 @@
5865

5966
<PropertyGroup>
6067
<PublishContainerDependsOn>
68+
_ContainerVerifySDKVersion;
6169
ComputeContainerConfig
6270
</PublishContainerDependsOn>
6371
</PropertyGroup>

0 commit comments

Comments
 (0)