Skip to content

Commit 08c09df

Browse files
committed
remove artificial block for linux-x64
1 parent a00a519 commit 08c09df

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

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

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@
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-
3326
<Target Name="ComputeContainerConfig">
3427
<!-- Reference data about this project -->
3528
<PropertyGroup>
@@ -51,6 +44,8 @@
5144
<ContainerRegistry Condition="'$(RegistryUrl)' != ''">$(RegistryUrl)</ContainerRegistry>
5245
<!-- PublishImageTag is used by existing VS targets for Docker builds - this lets us fill that void -->
5346
<ContainerImageTag Condition="'$(PublishImageTag)' != ''">$(PublishImageTag)</ContainerImageTag>
47+
<!-- This line is a compatibility shim for VS support - the VS container targets define a container tag using this property and format. This lets us be a drop-in replacement for them. -->
48+
<ContainerImageTag Condition="'$(AutoGenerateImageTag)' == 'true'">$([System.DateTime]::UtcNow.ToString('yyyyMMddhhmmss'))</ContainerImageTag>
5449
</PropertyGroup>
5550

5651
<!-- Container Defaults -->
@@ -64,9 +59,11 @@
6459
<ContainerImageName Condition="'$(ContainerImageName)' == ''">$(AssemblyName)</ContainerImageName>
6560
<!-- Only default a tag name if no tag names at all are provided -->
6661
<ContainerImageTag Condition="'$(ContainerImageTag)' == '' and '$(ContainerImageTags)' == ''">$(Version)</ContainerImageTag>
67-
<ContainerImageTag Condition="'$(AutoGenerateImageTag)' == 'true'">$([System.DateTime]::UtcNow.ToString('yyyyMMddhhmmss'))</ContainerImageTag>
6862
<ContainerWorkingDirectory Condition="'$(ContainerWorkingDirectory)' == ''">/app</ContainerWorkingDirectory>
69-
<!-- Could be semicolon-delimited -->
63+
<!-- The Container RID should default to the RID used for the entire build (to ensure things run on the platform they are built for), but the user knows best and so should be able to set it explicitly.
64+
For builds that have a RID, we default to that RID. Otherwise, we default to the RID of the currently-executing SDK. -->
65+
<ContainerRuntimeIdentifier Condition="'$(ContainerRuntimeIdentifier)' == '' and '$(IsRidAgnostic)' == 'true'">$(RuntimeIdentifier)</ContainerRuntimeIdentifier>
66+
<ContainerRuntimeIdentifier Condition="'$(ContainerRuntimeIdentifier)' == '' ">$(NETCoreSdkPortableRuntimeIdentifier)</ContainerRuntimeIdentifier>
7067
</PropertyGroup>
7168

7269
<ItemGroup Label="Entrypoint Assignment">
@@ -77,6 +74,7 @@
7774
</ItemGroup>
7875

7976
<ItemGroup Label="Conventional Label assignment">
77+
<!-- TODO: This impacts build reproducibility - it should probably be settable/conditioned on a property -->
8078
<ContainerLabel Include="org.opencontainers.image.created" Value="$([System.DateTime]::UtcNow.ToString('o'))" />
8179
</ItemGroup>
8280

@@ -108,7 +106,6 @@
108106
<PropertyGroup>
109107
<PublishContainerDependsOn>
110108
_ContainerVerifySDKVersion;
111-
_ContainerVerifyRuntime;
112109
ComputeContainerConfig
113110
</PublishContainerDependsOn>
114111
</PropertyGroup>
@@ -137,7 +134,7 @@
137134
Labels="@(ContainerLabel)"
138135
ExposedPorts="@(ContainerPort)"
139136
ContainerEnvironmentVariables="@(ContainerEnvironmentVariables)"
140-
ContainerRuntimeIdentifier="$(RuntimeIdentifier)">
137+
ContainerRuntimeIdentifier="$(ContainerRuntimeIdentifier)">
141138
<Output TaskParameter="GeneratedContainerManifest" PropertyName="GeneratedContainerManifest" />
142139
<Output TaskParameter="GeneratedContainerConfiguration" PropertyName="GeneratedContainerConfiguration" />
143140
</CreateNewImage>

0 commit comments

Comments
 (0)