Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to specify one frameworks: net6.0, net8.0 ? #460

Closed
ha0lyu opened this issue Dec 8, 2023 · 2 comments
Closed

How to specify one frameworks: net6.0, net8.0 ? #460

ha0lyu opened this issue Dec 8, 2023 · 2 comments

Comments

@ha0lyu
Copy link

ha0lyu commented Dec 8, 2023

Hello, I am learning the SBOM and I am trying to generate SBOM file by this tool, but when I 'docker build . -t ms_sbom_tool' the following error occurs:

Sending build context to Docker daemon  4.442MB
Step 1/12 : FROM mcr.microsoft.com/dotnet/sdk AS build-env
 ---> c607979be6d9
Step 2/12 : COPY . /app
 ---> 0fd7348db5d2
Step 3/12 : WORKDIR /app/src/Microsoft.Sbom.Tool
 ---> Running in 4afbf35065d3
Removing intermediate container 4afbf35065d3
 ---> 075dc133b6f0
Step 4/12 : ARG RUNTIME=linux-x64
 ---> Running in 3279f8071f5b
Removing intermediate container 3279f8071f5b
 ---> 1efe06ad5670
Step 5/12 : RUN dotnet publish -r $RUNTIME --self-contained true -p:DebugType=None -p:DebugSymbols=false -p:PublishSingleFile=true -p:IncludeAllContentForSelfExtract=true -o output
 ---> Running in d033344bab27
MSBuild version 17.8.3+195e7f5a3 for .NET
  Determining projects to restore...
  Restored /app/src/Microsoft.Sbom.Extensions/Microsoft.Sbom.Extensions.csproj (in 1.89 min).  Restored /app/src/Microsoft.Sbom.Adapters/Microsoft.Sbom.Adapters.csproj (in 1.89 min).
  Restored /app/src/Microsoft.Sbom.Contracts/Microsoft.Sbom.Contracts.csproj (in 1.89 min).
  Restored /app/src/Microsoft.Sbom.Parsers.Spdx22SbomParser/Microsoft.Sbom.Parsers.Spdx22SbomParser.csproj (in 1.89 min).
  Restored /app/src/Microsoft.Sbom.Common/Microsoft.Sbom.Common.csproj (in 1.89 min).
  Restored /app/src/Microsoft.Sbom.Api/Microsoft.Sbom.Api.csproj (in 1.94 min).
  Restored /app/src/Microsoft.Sbom.Extensions.DependencyInjection/Microsoft.Sbom.Extensions.DependencyInjection.csproj (in 1.94 min).
  Restored /app/src/Microsoft.Sbom.Tool/Microsoft.Sbom.Tool.csproj (in 2.46 min).
/usr/share/dotnet/sdk/8.0.100/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.CrossTargeting.targets(31,5): error NETSDK1129: The 'Publish' target is not supported without specifying a
target framework. The current project targets multiple frameworks, you must specify one of the following frameworks in order to publish: net6.0, net8.0 [/app/src/Microsoft.Sbom.Tool/Microsoft.Sbom.Tool.csproj]
The command '/bin/sh -c dotnet publish -r $RUNTIME --self-contained true -p:DebugType=None -p:DebugSymbols=false -p:PublishSingleFile=true -p:IncludeAllContentForSelfExtract=true -o output' returned a non-zero code: 1

How can I specify a framework? BTW: I followed: Building SBOM tool as docker image.

@sebasgomez238
Copy link
Contributor

sebasgomez238 commented Dec 8, 2023

Looks like our Dockerfile needs to be updated thank you for pointing this out, in the meantime you could try changing this line and building again:

https://github.com/microsoft/sbom-tool/blob/main/Dockerfile#L5

to:
RUN dotnet publish -f net8.0 -r $RUNTIME --self-contained true -p:DebugType=None -p:DebugSymbols=false -p:PublishSingleFile=true -p:IncludeAllContentForSelfExtract=true -o output

@ha0lyu
Copy link
Author

ha0lyu commented Dec 9, 2023

Thanks for your help, it has been successfully built according to your method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants