The SDK 'MSBuild.Sdk.SqlProj/2.6.1' specified could not be found
PraveenValavan opened this issue · 3 comments
I am trying to build the below .csproj with mcr.microsoft.com/dotnet/sdk:8.0 in a Dockerfile.
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<SqlServerVersion>SqlAzure</SqlServerVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Content Include="..\..\Env\Application.Database.Environment\**\*.sql" />
</ItemGroup>
However, it's failing with the error in the build step.
Unable to find package MSBuild.Sdk.SqlProj. No packages exist with this id in source(s): nuget.org MSB4276: The default SDK resolver failed to resolve SDK "MSBuild.Sdk.SqlProj" because directory "/usr/share/dotnet/sdk/8.0.101/Sdks/MSBuild.Sdk.SqlProj/Sdk" did not exist. The SDK 'MSBuild.Sdk.SqlProj/2.6.1' specified could not be found
I am not sure if this is intended to work this way. However, I am trying to build a docker image with the dacpac and then would run sqlPackage in this container in a separate Azure devops pipeline to deploy to the databases.
This is my docker file
# Use the official .NET SDK image as the base image
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
# Set arguments
ARG Database=Environment
ARG PROJECT_NAME=Application.Database.Build.$Database.csproj
ARG SERVICE_PATH=/Build/Environment
ARG RELATED_CODE_PATH=/Environment
WORKDIR /app
# # Copy related code
COPY --chown=1001 ./$RELATED_CODE_PATH ./$RELATED_CODE_PATH
# Copy the necessary project files to the container
COPY --chown=1001 ./$SERVICE_PATH ./$SERVICE_PATH
# Set the working directory inside the container
WORKDIR /app/$SERVICE_PATH
# Restore
RUN dotnet restore $PROJECT_NAME
# Buidl and Publish
RUN dotnet build -c Release $PROJECT_NAME -o /app/dacpacs && \
dotnet publish --no-restore -c Release -o /app/publish
# Set up the runtime image
FROM mcr.microsoft.com/dotnet/runtime:7.0 AS runtime
# Copy the built application from the build image
COPY --from=build /app/out .
Please share the full csproj content, not just fragments
Thas is all I have in the csproj file, its just a simple csproj with reference to sql files in a ssdt project. I also couldn't find any documentation related to dockerization, it would be awesome if you could point me to some.
This was a network issue related to a firewall, not the tool itself.