Skip to content

Commit da83f2f

Browse files
authored
Merge pull request #145 from dotnet/ri-0.1.errormessage
Integrate error message PR into main branch
2 parents adf3104 + 2b2d07d commit da83f2f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
<Project>
2+
<Target Name="_ContainerVerifySDKVersion"
3+
Condition="'$(WebPublishMethod)' == 'Container' or '$(PublishProfile)' == 'DefaultContainer'"
4+
BeforeTargets="AfterPublish">
5+
<!-- If the user has opted into container publishing via their own profile (WebPublishMethod = Container) or
6+
via the default Profile (PublishProfile = DefaultContainer), make sure they're on a supported SDK version.
7+
We do the explicit profile name check here because for preview6 for example the profile didn't exist, so we
8+
can't rely only on the WebPublishMethod. -->
9+
<PropertyGroup>
10+
<!-- Allow preview 7, any RC, or any stable version of 7 -->
11+
<_IsAllowedVersion Condition="$(NETCoreSdkVersion.StartsWith('7.0.100-preview.7')) or $(NETCoreSdkVersion.StartsWith('7.0.100-rc')) or ($(NETCoreSdkVersion.StartsWith('7.0.10')) and $(NETCoreSdkVersion.Contains('-')) == false)">true</_IsAllowedVersion>
12+
</PropertyGroup>
13+
<Error Condition="'$(_IsAllowedVersion)' != 'true'" Code="CONTAINER002" Text="The current .NET SDK ($(NETCoreSdkVersion)) doesn't support containerization. Please use version 7.0.100-preview.7 or higher." />
14+
</Target>
15+
216
<Target Name="ComputeContainerConfig">
317
<!-- Reference data about this project -->
418
<PropertyGroup>
@@ -63,6 +77,7 @@
6377

6478
<PropertyGroup>
6579
<PublishContainerDependsOn>
80+
_ContainerVerifySDKVersion;
6681
ComputeContainerConfig
6782
</PublishContainerDependsOn>
6883
</PropertyGroup>

0 commit comments

Comments
 (0)