Error Build .NET SDK not supports .NET 8.0

franciscobispoTRIAL

a year 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/ASVendasApi/ASVendasApi.csproj]

5 Replies

a year ago


franciscobispoTRIAL

a year 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 BUILDCONFIGURATION=Release WORKDIR /src COPY ["ASVendasApi/ASVendasApi.csproj", "ASVendasApi/"] RUN dotnet restore "./ASVendasApi/./ASVendasApi.csproj" COPY . . WORKDIR "/src/ASVendasApi" RUN dotnet build "./ASVendasApi.csproj" -c %BUILDCONFIGURATION% -o /app/build

FROM build AS publish
ARG BUILDCONFIGURATION=Release RUN dotnet publish "./ASVendasApi.csproj" -c %BUILDCONFIGURATION% -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ASVendasApi.dll"]

my global.json file:
{
"sdk": {
"version": "8.0.101"
}
}


franciscobispoTRIAL

a year ago

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

6.136 /app/ASVendasApi/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/ASVendasApi/ASVendasApi.csproj]

6.136 /app/ASVendasApi/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/ASVendasApi/ASVendasApi.csproj]


franciscobispoTRIAL

a year 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;
}


davidbelleroseHOBBY

10 months ago

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

6.136 /app/ASVendasApi/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/ASVendasApi/ASVendasApi.csproj]

6.136 /app/ASVendasApi/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/ASVendasApi/ASVendasApi.csproj]

How did you resolve the problem?