Auto-generated Dockerfile fails with Invalid framework identifier ''
See original GitHub issueVersion Used:
6.0.406
Steps to Reproduce:
- Create a .NET 6 library ./Src/MyLib
- Create a .NET 6 asp.net core hosted Blazor Wasm Application ./BlazorWasmDemo without docker support
- Add docker support to BlazorWasmDemo.Server project
- Build docker image from Dockerfile
- dotnet restore in build stage of Dockerfile fails
Actual Branch with problem: https://github.com/Regenhardt/fido2-net-lib/tree/feature/blazor-wasm
Diagnostic Id:
NETSDK 1013
Expected Behavior:
Dockerfile should build a runnable docker image.
Actual Behavior:
dotnet restore fails with /usr/share/dotnet/sdk/6.0.406/NuGet.targets(132,5): error : Invalid framework identifier ''. [/src/BlazorWasmDemo/Server/BlazorWasmDemo.Server.csproj]
** Additional info**:
I started up the image from a state just before the error occurs:
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS prebuild
WORKDIR /src
COPY ["nuget.config", "."]
COPY ["BlazorWasmDemo/Server/BlazorWasmDemo.Server.csproj", "BlazorWasmDemo/Server/"]
COPY ["Src/Fido2.AspNet/Fido2.AspNet.csproj", "Src/Fido2.AspNet/"]
COPY ["Src/Fido2/Fido2.csproj", "Src/Fido2/"]
COPY ["Src/Fido2.Models/Fido2.Models.csproj", "Src/Fido2.Models/"]
COPY ["BlazorWasmDemo/Client/BlazorWasmDemo.Client.csproj", "BlazorWasmDemo/Client/"]
COPY ["Src/Fido2.BlazorWebAssembly/Fido2.BlazorWebAssembly.csproj", "Src/Fido2.BlazorWebAssembly/"]
COPY ["BlazorWasmDemo/Shared/BlazorWasmDemo.Shared.csproj", "BlazorWasmDemo/Shared/"]
FROM prebuild as build
# This one crashes:
RUN dotnet restore "BlazorWasmDemo/Server/BlazorWasmDemo.Server.csproj"
COPY . .
WORKDIR "/src/BlazorWasmDemo/Server"
RUN dotnet build "BlazorWasmDemo.Server.csproj" -c Release -o /app/build
I then ran the dotnet restore
command from a bash within the image, hoping to get more information, but I got exactly the same as before without extra information. I did however check the files before running it:
root@af1009dcaf2c:/src# ls BlazorWasmDemo/Server
BlazorWasmDemo.Server.csproj
root@af1009dcaf2c:/src# cat BlazorWasmDemo/Server/BlazorWasmDemo.Server.csproj
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>d4e312c9-f55a-43e0-b3ea-699aa6421a5c</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<DockerfileContext>..\..</DockerfileContext>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.13" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Src\Fido2.AspNet\Fido2.AspNet.csproj" />
<ProjectReference Include="..\..\Src\Fido2\Fido2.csproj" />
<ProjectReference Include="..\Client\BlazorWasmDemo.Client.csproj" />
</ItemGroup>
</Project>
root@af1009dcaf2c:/src# dotnet restore BlazorWasmDemo/Server/BlazorWasmDemo.Server.csproj
Determining projects to restore...
/usr/share/dotnet/sdk/6.0.406/NuGet.targets(132,5): error : Invalid framework identifier ''. [/src/BlazorWasmDemo/Server/BlazorWasmDemo.Server.csproj]
And I’m pretty sure the <TargetFramework>net6.0</TargetFramework>
should be used by dotnet. I did however replace it with <TargetFrameworks>
(plural) but the same error happens.
Without this dockerfile, the application works, both running as exe and starting in docker from within VS.
Issue Analytics
- State:
- Created 6 months ago
- Comments:12 (6 by maintainers)
Top GitHub Comments
Alright I submitted a ticket describing the issue.
If you have time, submitting the need to include Directory.Build.props (and many other necessary files like Directory.Build.targets, Directory.Packages.props, etc) in the generated Dockerfile over at VS Feedback would be great - the Docker tooling team does get feedback submitted through that method.