Forum Discussion

RobTedTech's avatar
RobTedTech
Copper Contributor
Mar 25, 2024

AzureContainerApps@1 Multiple Projects

Hi All

 

I have a .Net Solution with multiple Projects. I am trying to use AzureContainerApps@1 to deploy via a Pipeline but I am struggling with the appSourcePath. If I leave as $(System.DefaultWorkingDirectory) I get an Ambiguous project error, if I specify the path to the project the build fails as cannot find the project references:

 

warning : The referenced project '../../../0.Build/xxxx/xxxx.csproj' does not exist. The code exist in a Github repo and all local builds etc work perfectly. Has anyone had similar issue and solved?

 

Thanks,

Rob

    • RobTedTech's avatar
      RobTedTech
      Copper Contributor

      jonahandersson 

       

      Thanks very much for the info. I managed to solve my issue by using a docker file. I have a a 'src' folder with the various projects, I created a 'dockerfiles' folder (both in the solution root directory) and used the following dockerfile:

       

      FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
      WORKDIR /app

      COPY . ../
      RUN dotnet restore ../src/PROJECT_NAME/*.csproj
      RUN dotnet publish ../src/PROJECT_NAME/*.csproj -c Release -o out

      # Build runtime image
      FROM mcr.microsoft.com/dotnet/aspnet:8.0
      WORKDIR /app
      COPY --from=build-env /app/out .
      ENTRYPOINT ["dotnet", "PROJECT_NAME.dll"]

       

      Each Project will need a separate dockerfile in the folder but it builds perfectly with all dependencies.

       

      Hope this helps somewhat.

      Cheers,

      Rob

Resources