Skip to content

Commit 738731f

Browse files
Merge pull request #245 from dotnet/v0.2
Merge 0.2 release branch to main
2 parents 961dfdd + 3425e91 commit 738731f

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

Microsoft.NET.Build.Containers/CreateNewImageToolTask.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,12 @@ protected override string GenerateCommandLineCommands()
186186
" --outputregistry " + OutputRegistry +
187187
" --imagename " + ImageName +
188188
" --workingdirectory " + WorkingDirectory +
189-
(Entrypoint.Length > 0 ? " --entrypoint " + Entrypoint.Select((i) => i.ItemSpec).Aggregate((i, s) => s += i + " ") : "") +
190-
(Labels.Length > 0 ? " --labels " + Labels.Select((i) => i.ItemSpec + "=" + i.GetMetadata("Value")).Aggregate((i, s) => s += i + " ") : "") +
191-
(ImageTags.Length > 0 ? " --imagetags " + ImageTags.Select((i) => i.ItemSpec).Aggregate((i, s) => s += i + " ") : "") +
192-
(EntrypointArgs.Length > 0 ? " --entrypointargs " + EntrypointArgs.Select((i) => i.ItemSpec).Aggregate((i, s) => s += i + " ") : "") +
193-
(ExposedPorts.Length > 0 ? " --ports " + ExposedPorts.Select((i) => i.ItemSpec + "/" + i.GetMetadata("Type")).Aggregate((i, s) => s += i + " ") : "") +
194-
(ContainerEnvironmentVariables.Length > 0 ? " --environmentvariables " + ContainerEnvironmentVariables.Select((i) => i.ItemSpec + "=" + i.GetMetadata("Value")).Aggregate((i, s) => s += i + " ") : "");
189+
(Entrypoint.Length > 0 ? " --entrypoint " + String.Join(" ", Entrypoint.Select((i) => i.ItemSpec)) : "") +
190+
(Labels.Length > 0 ? " --labels " + String.Join(" ", Labels.Select((i) => i.ItemSpec + "=" + Quote(i.GetMetadata("Value")))) : "") +
191+
(ImageTags.Length > 0 ? " --imagetags " + String.Join(" ", ImageTags.Select((i) => Quote(i.ItemSpec))) : "") +
192+
(EntrypointArgs.Length > 0 ? " --entrypointargs " + String.Join(" ", EntrypointArgs.Select((i) => i.ItemSpec)) : "") +
193+
(ExposedPorts.Length > 0 ? " --ports " + String.Join(" ", ExposedPorts.Select((i) => i.ItemSpec + "/" + i.GetMetadata("Type"))) : "") +
194+
(ContainerEnvironmentVariables.Length > 0 ? " --environmentvariables " + String.Join(" ", ContainerEnvironmentVariables.Select((i) => i.ItemSpec + "=" + Quote(i.GetMetadata("Value")))) : "");
195195
}
196196

197197
private string Quote(string path)

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)