This is a plain-vanilla ASP.NET Core (.NET 6.0) API project with a single controller/action. Publishing it directly from Visual Studio 2022 to a Linux based App Service on Azure works fine. The exact same code deployed from Azure DevOps fails (the app service fails on startup).
Here's the error from the Log Stream:
The application 'project-name.dll' does not exist.
You intended to execute a .NET SDK command:
No .NET SDKs were found
(that's essentially the docker error from the app service)
Here's the azure-pipelines.yml file used by the DevOps Pipeline.
trigger:
- main
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
- task: NuGetCommand@2
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
inputs:
solution: '$(solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:DesktopBuildPackageLocation="$(build.artifactStagingDirectory)\WebApp.zip" /p:DeployIisAppPath="Default Web Site"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: VSTest@2
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: PublishBuildArtifacts@1
displayName: 'publish artifacts'
The Pipeline builds fine - no errors. The release then runs fine - no errors. What is different about the DevOps CICD flow compared to the VS 2022 direct publish? What step am I missing here?
Thank you for any help.
More Info:
So, I've noticed this difference now by bash-ing into the app service.
When I publish from VS 2022 - all the files from the deployment including the project-name.dll are in ~/site/wwwroot.
When Azure DevOps does the deploy, the file structure is not the same. I think that's the root of the problem. There, wwwroot has a Content directory and inside that, there is a convoluted folder structure that goes D_C/a/1/s/project-name/obj/Release/net6.0/PubTemp/Out. And inside Out are the files needed to run including project-name.dll.
No wonder it's not running. Anyone has any idea why Azure DevOps is doing this