rr-wfm / MSBuild.Sdk.SqlProj

An MSBuild SDK that provides similar functionality to SQL Server Data Tools (.sqlproj) projects
MIT License
380 stars 42 forks source link

The SDK 'MSBuild.Sdk.SqlProj/2.6.1' specified could not be found #506

Closed PraveenValavan closed 5 months ago

PraveenValavan commented 5 months ago

I am trying to build the below .csproj with mcr.microsoft.com/dotnet/sdk:8.0 in a Dockerfile.

netstandard2.0 SqlAzure enable enable

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 .
ErikEJ commented 5 months ago

Please share the full csproj content, not just fragments

PraveenValavan commented 5 months ago

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.

PraveenValavan commented 5 months ago

This was a network issue related to a firewall, not the tool itself.