question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Auto-generated Dockerfile fails with Invalid framework identifier ''

See original GitHub issue

Version Used:
6.0.406 Steps to Reproduce:

  1. Create a .NET 6 library ./Src/MyLib
  2. Create a .NET 6 asp.net core hosted Blazor Wasm Application ./BlazorWasmDemo without docker support
  3. Add docker support to BlazorWasmDemo.Server project
  4. Build docker image from Dockerfile
  5. 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:closed
  • Created 6 months ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
Regenhardtcommented, Mar 6, 2023

Alright I submitted a ticket describing the issue.

2reactions
baronfelcommented, Mar 6, 2023

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid framework identifier Dotnet restore, docker build
i'm having this error when i try to run docker build in my dotnet core API: Invalid framework identifier ''. Here is my...
Read more >
Restoring results in obscure error: Invalid framework identifier
Details about Problem I am trying to build one of the project for Linux operating system and it fails with the .NET SDK...
Read more >
Invalid framework identifier Dotnet restore, docker build-docker
the problem was that i needed to copy my directory.build.props file and now is working. just added this line to my dockerfile copy...
Read more >
Troubleshoot topics for Docker Desktop
If the user ID length is such that the absolute path of the socket exceeds the OS path length limitation, then Docker Desktop...
Read more >
Configuring a registry
The htpasswd file is loaded once, at startup. If the file is invalid, the registry will display an error and will not start....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found