Skip to content

Commit

Permalink
[DO NOT MERGE] Restore ability for users to consume the containers pa…
Browse files Browse the repository at this point in the history
…ckage easily (#43794)

Co-authored-by: Chet Husk <chusk3@gmail.com>
  • Loading branch information
surayya-MS and baronfel authored Oct 4, 2024
1 parent 7e822f0 commit 29991fa
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
6 changes: 6 additions & 0 deletions src/Containers/Microsoft.NET.Build.Containers/KnownStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,14 @@ public static class Items

public static class ErrorCodes
{
// current version doesn't support containerization
public static readonly string CONTAINER002 = nameof(CONTAINER002);
// containerimagename rename
public static readonly string CONTAINER003 = nameof(CONTAINER003);
// generic http error
public static readonly string CONTAINER004 = nameof(CONTAINER004);
// don't use the containers package
public static readonly string CONTAINER005 = nameof(CONTAINER005);
public static readonly string CONTAINER1011 = nameof(CONTAINER1011);
public static readonly string CONTAINER1012 = nameof(CONTAINER1012);
public static readonly string CONTAINER1013 = nameof(CONTAINER1013);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@
($(_SdkCanPublishWorker) and $(_IsWorkerProject)) or
($(_SdkCanPublishConsole) and '$(EnableSdkContainerSupport)' == 'true')
)"
Code="CONTAINER005"
Text="The $(_ContainersPackageIdentity) NuGet package is explicitly referenced but the current SDK can natively publish the project as a container. Consider removing the package reference to $(_ContainersPackageIdentity) because it is no longer needed." />

<PropertyGroup>
Expand Down
6 changes: 4 additions & 2 deletions src/Tasks/Microsoft.NET.Build.Tasks/sdk/Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,14 @@ Copyright (c) .NET Foundation. All rights reserved.

<!-- Import targets from Microdoft.NET.Build.Container.targets -->
<PropertyGroup>
<_ContainersTargetsDir Condition=" '$(_ContainersTargetsDir)'=='' ">$(MSBuildThisFileDirectory)..\..\..\Containers\build\</_ContainersTargetsDir>
<_IsNotSetContainersTargetsDir>false</_IsNotSetContainersTargetsDir>
<_IsNotSetContainersTargetsDir Condition=" '$(_ContainersTargetsDir)'=='' ">true</_IsNotSetContainersTargetsDir>
<_ContainersTargetsDir Condition="$(_IsNotSetContainersTargetsDir)">$(MSBuildThisFileDirectory)..\..\..\Containers\build\</_ContainersTargetsDir>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)..\..\..\Containers\build\Microsoft.NET.Build.Containers.props"
Condition="Exists('$(MSBuildThisFileDirectory)..\..\..\Containers\build\Microsoft.NET.Build.Containers.props')" />

<Import Project="$(_ContainersTargetsDir)Microsoft.NET.Build.Containers.targets"
Condition="Exists('$(_ContainersTargetsDir)Microsoft.NET.Build.Containers.targets') AND '$(TargetFramework)' != ''" />
Condition="$(_IsNotSetContainersTargetsDir) AND Exists('$(_ContainersTargetsDir)Microsoft.NET.Build.Containers.targets') AND '$(TargetFramework)' != ''" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public async Task EndToEnd_NoAPI_ProjectType(string projectType, bool addPackage

if (addPackageReference)
{
commandResult.Should().HaveStdOutContaining("warning : The Microsoft.NET.Build.Containers NuGet package is explicitly referenced but the current SDK can natively publish the project as a container. Consider removing the package reference to Microsoft.NET.Build.Containers because it is no longer needed.");
commandResult.Should().HaveStdOutContaining("warning CONTAINER005: The Microsoft.NET.Build.Containers NuGet package is explicitly referenced but the current SDK can natively publish the project as a container. Consider removing the package reference to Microsoft.NET.Build.Containers because it is no longer needed.");
}
else
{
Expand Down

0 comments on commit 29991fa

Please # to comment.