Skip to content

Commit 165085d

Browse files
authored
[automated] Merge branch 'release/9.0.2xx' => 'release/9.0.3xx' (#47335)
2 parents ae300dd + 1865a73 commit 165085d

File tree

4 files changed

+24
-6
lines changed

4 files changed

+24
-6
lines changed

src/Containers/Microsoft.NET.Build.Containers/Resources/Strings.Designer.cs

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,24 @@ internal async Task<bool> ExecuteAsync(CancellationToken cancellationToken)
143143
}
144144
}
145145

146+
// forcibly change the media type if required
147+
if (ImageFormat is not null)
148+
{
149+
if (Enum.TryParse<KnownImageFormats>(ImageFormat, out var imageFormat))
150+
{
151+
imageBuilder.ManifestMediaType = imageFormat switch
152+
{
153+
KnownImageFormats.Docker => SchemaTypes.DockerManifestV2,
154+
KnownImageFormats.OCI => SchemaTypes.OciManifestV1,
155+
_ => imageBuilder.ManifestMediaType // should be impossible unless we add to the enum
156+
};
157+
}
158+
else
159+
{
160+
Log.LogErrorWithCodeFromResources(nameof(Strings.InvalidContainerImageFormat), ImageFormat, string.Join(",", Enum.GetValues<KnownImageFormats>()));
161+
}
162+
}
163+
146164
Layer newLayer = Layer.FromDirectory(PublishDirectory, WorkingDirectory, imageBuilder.IsWindows, imageBuilder.ManifestMediaType);
147165
imageBuilder.AddLayer(newLayer);
148166
imageBuilder.SetWorkingDirectory(WorkingDirectory);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@
255255
BaseRegistry="$(ContainerBaseRegistry)"
256256
BaseImageName="$(ContainerBaseName)"
257257
BaseImageTag="$(ContainerBaseTag)"
258-
ImageFormat="$(ContainerImageFormat)"
259258
BaseImageDigest="$(ContainerBaseDigest)"
259+
ImageFormat="$(ContainerImageFormat)"
260260
LocalRegistry="$(LocalRegistry)"
261261
OutputRegistry="$(ContainerRegistry)"
262262
ArchiveOutputPath="$(ContainerArchiveOutputPath)"

test/dotnet-sln.Tests/GivenDotnetSlnAdd.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,10 +244,11 @@ public void WhenNestedProjectIsAddedSolutionFoldersAreCreated(string solutionCom
244244
}
245245

246246
[Theory]
247-
//[InlineData("sln", true, ".sln")]
248-
//[InlineData("sln", false, ".sln")]
249-
//[InlineData("solution", true, ".sln")]
250-
//[InlineData("solution", false, ".sln")]
247+
// needs https://github.com/microsoft/vs-solutionpersistence/pull/101
248+
// [InlineData("sln", true, ".sln")]
249+
// [InlineData("sln", false, ".sln")]
250+
// [InlineData("solution", true, ".sln")]
251+
// [InlineData("solution", false, ".sln")]
251252
[InlineData("sln", true, ".slnx")]
252253
[InlineData("solution", false, ".slnx")]
253254
public void WhenNestedProjectIsAddedSolutionFoldersAreCreatedBuild(string solutionCommand, bool fooFirst, string solutionExtension)

0 commit comments

Comments
 (0)