@Ben Brandt Welcome to Microsoft Q&A Forum, Thank you for posting your query here! I'm glad to see you were able to resolve your issue. Thanks for posting your solution so that others experiencing the same thing can easily reference this. Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer, they can only accept answers by others, I'll repost your solution in case you'd like to Accept the answer.
.
Issue:
You have an ASP.NET Core project that you are trying to publish to an Azure Container registry with dotnet publish. You are getting this error:
C:\src\path-to-project\Project.Api.csproj : error : The attribute "Include" in element <ContainerEnvironmentVariable> is unrecognized.
.
Resolution:
The container environment variable node allows you to add environment variables to the container. Environment variables are accessible to the app running in the container immediately, and are often used to change the run-time behavior of the running app.
The ContainerEnvironmentVariable
node has two attributes:
-
Include
: The name of the environment variable. -
Value
: The value of the environment variable.
<ItemGroup>
<ContainerEnvironmentVariable Include="LOGGER_VERBOSITY" Value="Trace" />
</ItemGroup>
So it should be an ItemGroup and not a PropertyGroup. More info here.