Base solution for your next web application
Open Closed

Azure DevOps Build Pipeline #7201


User avatar
0
abrewer created

Hello,

Im trying to utilize Azure DevOps to setup a CI\CD pipeline. I am able to build and run my container locally on a windows 10 machine, however when I attempt to using the docker file to build within Azure DevOps build pipeline im getting an error on the container

Did you mean to run dotnet SDK commands? Please install dotnet SDK from:
  https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409

I suspect that the issue is that Im not getting my source code DLLs included in my pipeline created image, I have be able to confirm this my taking my working container, sh access run an ls command, and I can see my dlls. On my pipeline created image, I do not see these DLLs when I perform the same command. I am only using the Dockerfile in the Web.Host project, I think im missing something.


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    Here is a related article, you can take a look.

    https://docs.aspnetzero.com/documents/aspnet-core-mvc/latest/Setting-Up-an-Azure-Pipeline-Mvc-Core

  • User Avatar
    0
    abrewer created

    This does not address my real issue. My problem is getting the azure devops pipeline to build the container the same way that the build-with-ng.ps1 script does.

  • User Avatar
    0
    alper created
    Support Team

    I think you need to publish your website as a self-contained package. to do this add your publish command --self-contained true option.

    In your build-with-ng.ps1 file, you can replace the below lines:

    • dotnet publish --output (Join-Path $outputFolder "Host") --configuration Release
    • dotnet publish --output (Join-Path $outputFolder "Public") --configuration Release

    with these line:

    • dotnet publish -c Release -r linux-x64 --self-contained true -o (Join-Path $outputFolder "Host")
    • dotnet publish -c Release -r linux-x64 --self-contained true -o (Join-Path $outputFolder "Public")

    (I'm not sure to add double quotes to (Join-Path $outputFolder "Host") you can change it to "(Join-Path $outputFolder "Host")" if it doesn't work.)

    note that while we use linux-x64 option for Linux images, win-x64is used for Windows images.

  • User Avatar
    0
    abrewer created

    Thank you that worked!