Error Build .NET SDK not supports .NET 8.0
franciscobispo
TRIALOP

2 years ago

Error Build .NET SDK not supports .NET 8.0

Please, help me.

1.915 /nix/store/0f43yfx91hg74bcp66qkbp97zv3ln27i-dotnet-sdk-6.0.413/sdk/6.0.413/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.TargetFrameworkInference.targets(144,5): error NETSDK1045: The current .NET SDK does not support targeting .NET 8.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 8.0. [/app/AS_Vendas_Api/AS_Vendas_Api.csproj]

5 Replies

2 years ago


franciscobispo
TRIALOP

2 years ago

Thanks for your response, but not resolved the problem.

my dockerfile:

FROM mcr.microsoft.com/dotnet/aspnet:8.0-nanoserver-1809 AS base

WORKDIR /app

EXPOSE 8080

EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:8.0-nanoserver-1809 AS build

ARG BUILD_CONFIGURATION=Release

WORKDIR /src

COPY ["AS_Vendas_Api/AS_Vendas_Api.csproj", "AS_Vendas_Api/"]

RUN dotnet restore "./AS_Vendas_Api/./AS_Vendas_Api.csproj"

COPY . .

WORKDIR "/src/AS_Vendas_Api"

RUN dotnet build "./AS_Vendas_Api.csproj" -c %BUILD_CONFIGURATION% -o /app/build

FROM build AS publish

ARG BUILD_CONFIGURATION=Release

RUN dotnet publish "./AS_Vendas_Api.csproj" -c %BUILD_CONFIGURATION% -o /app/publish /p:UseAppHost=false

FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

ENTRYPOINT ["dotnet", "AS_Vendas_Api.dll"]


my global.json file:

{

"sdk": {

"version": "8.0.101"

}

}


franciscobispo
TRIALOP

2 years ago

I resolved the problem, but now the error message is this:

6.136 /app/AS_Vendas_Api/DTOs/Base/Response/ErrorResponse.cs(3,27): error CS8652: The feature 'primary constructors' is currently in Preview and unsupported. To use Preview features, use the 'preview' language version. [/app/AS_Vendas_Api/AS_Vendas_Api.csproj]

6.136 /app/AS_Vendas_Api/DTOs/Base/Response/ServiceBaseResponse.cs(3,33): error CS8652: The feature 'primary constructors' is currently in Preview and unsupported. To use Preview features, use the 'preview' language version. [/app/AS_Vendas_Api/AS_Vendas_Api.csproj]


franciscobispo
TRIALOP

2 years ago

the classes is this:

public class ServiceBaseResponse(object data, bool success = true)

{

public bool Success { get; } = success;

public object Data { get; } = data;

}

public class ErrorResponse(object erro)

{

public object Erro { get; set; } = erro;

}


davidbellerose
HOBBY

2 years ago

I resolved the problem, but now the error message is this:

6.136 /app/AS_Vendas_Api/DTOs/Base/Response/ErrorResponse.cs(3,27): error CS8652: The feature 'primary constructors' is currently in Preview and unsupported. To use Preview features, use the 'preview' language version. [/app/AS_Vendas_Api/AS_Vendas_Api.csproj]

6.136 /app/AS_Vendas_Api/DTOs/Base/Response/ServiceBaseResponse.cs(3,33): error CS8652: The feature 'primary constructors' is currently in Preview and unsupported. To use Preview features, use the 'preview' language version. [/app/AS_Vendas_Api/AS_Vendas_Api.csproj]

How did you resolve the problem?


Welcome!

Sign in to your Railway account to join the conversation.

Loading...