Closed joeyadams-bec closed 4 months ago
This has to be a regression due to https://github.com/microsoft/vscode-docker/pull/4201. @baronfel any ideas why an all-caps project file name would cause the resolved target information to be any different?
Nothing immediately comes to mind - an https://aka.ms/binlog would help a lot to understand what's happening here. Casing + Ubuntu immedately makes me think there's some sensitivity issue in the build pipeline somewhere, which a binlog would show.
@baronfel It looks like the error is coming from the SDK, I'm able to reproduce on Windows too:
PS D:\Sandbox\FOO.BAR> dotnet build /r:false /t:GetProjectProperties /p:CustomAfterMicrosoftCommonTargets="d:\vscode-docker\resources\netCore\GetProjectProperties.targets" /p:CustomAfterMicrosoftCommonCrossTargetingTargets="d:\vscode-docker\resources\netCore\GetProjectProperties.targets" /p:InfoOutputPath="C:\Users\bwater\AppData\Local\Temp\585b710b-d675-4313-ad1c-ca3baeafe9f11708969717400-0.tmp" "d:\Sandbox\FOO.BAR\FOO.BAR.csproj"
MSBuild version 17.9.4+90725d08d for .NET
C:\Program Files\dotnet\sdk\8.0.200\Containers\build\Microsoft.NET.Build.Containers.targets(112,5): error CONTAINER2005: The inferred image name 'FOO.BAR' c
ontains entirely invalid characters. The valid characters for an image name are alphanumeric characters, -, /, or _, and the image name must start with an a
lphanumeric character. [d:\Sandbox\FOO.BAR\FOO.BAR.csproj]
Build FAILED.
C:\Program Files\dotnet\sdk\8.0.200\Containers\build\Microsoft.NET.Build.Containers.targets(112,5): error CONTAINER2005: The inferred image name 'FOO.BAR' c
ontains entirely invalid characters. The valid characters for an image name are alphanumeric characters, -, /, or _, and the image name must start with an a
lphanumeric character. [d:\Sandbox\FOO.BAR\FOO.BAR.csproj]
0 Warning(s)
1 Error(s)
Is there an MSBuild property that can be set as the image name?
@baronfel nevermind, found it.
@joeyadams-bec I was able to work around the issue by adding a property to the CSPROJ file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<ContainerRepository>foo.bar</ContainerRepository> <!-- Add this line -->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
</Project>
Property is documented here; it mentions this scenario:
If that name is invalid as a container image name, you can override it by specifying a
ContainerRepository
as shown in the following project file...
Based on above information, going to close this as appears it is an issue in the .NET SDK.
On Ubuntu 22.04, I cannot debug an ASP.NET Core app under Docker if the project name is all capital letters. But if I downgrade to Docker extension version v1.28.0, it works.
Steps:
dotnet new webapi -o FOO.BAR
In the terminal this appears as:
If I delete the FOO.BAR directory and repeat the steps above with Foo.Bar instead of FOO.BAR, it works. Also, if I complete the scaffold with Foo.Bar and then rename the project to FOO.BAR, debugging fails to launch with the same error.
Environment:
Installed VS Code Extensions:
Similar issue (same error message): https://github.com/microsoft/vscode-docker/issues/3791