Skip to content

Commit cf72f01

Browse files
Explicit error on non-Linux (#226)
* Explicit error on non-Linux We currently support only Linux base images, so add an explicit error in other cases. * feedback
1 parent 556bf50 commit cf72f01

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
<Error Condition="'$(_IsSDKContainerAllowedVersion)' != 'true'" Code="CONTAINER002" Text="The current .NET SDK ($(NETCoreSdkVersion)) doesn't support containerization. Please use version 7.0.100 or higher to enable containerization." />
2424
</Target>
2525

26+
<Target Name="_ContainerVerifyRuntime"
27+
Condition="'$(WebPublishMethod)' == 'Container' or '$(PublishProfile)' == 'DefaultContainer'"
28+
BeforeTargets="AfterPublish">
29+
<!-- https://github.com/dotnet/sdk-container-builds/issues/91 -->
30+
<Error Condition="'$(RuntimeIdentifier)' != 'linux-x64'" Code="CONTAINER006" Text="The Microsoft.NET.Build.Containers package does not (yet) support publishing for $([MSBuild]::ValueOrDefault('$(RuntimeIdentifier)', 'portable or no-RuntimeIdentifier-defined scenarios')). Please specify a runtime of &quot;linux-x64&quot;" />
31+
</Target>
32+
2633
<Target Name="ComputeContainerConfig">
2734
<!-- Reference data about this project -->
2835
<PropertyGroup>
@@ -101,6 +108,7 @@
101108
<PropertyGroup>
102109
<PublishContainerDependsOn>
103110
_ContainerVerifySDKVersion;
111+
_ContainerVerifyRuntime;
104112
ComputeContainerConfig
105113
</PublishContainerDependsOn>
106114
</PropertyGroup>

0 commit comments

Comments
 (0)