Hi Umbracians!
I’m using Umbraco for the first time and have a deployment / packaging problem on my Azure pipeline and was hoping someone out there might have a few ideas on how I might resolve the issue… Apologies in advance as this quite long!
First, a little background: I have a solution, in which I have 3 projects; 2 are class libraries that are used by the main Umbraco project. All references for Umbraco (in this case v8.12) are brought in using NuGet packages. Everything builds and runs perfectly on my local development machine, but when I attempt to deploy the solution from an Azure pipeline, I find that I’m missing some rather large chunks of Umbraco which are very much critical to the deployment (like the entire “Umbraco” folder!)
Within source control for the solution, I’ve deliberately excluded the contents of the “umbraco” folder from the Umbraco project, as I know that this folder and its contents are part of the NuGet package itself and the whole reason for me using the packages is to stop me including huge chunks of code that will be recreated as part of the NuGet restore step in the build process - and that bit works exactly as I expected within the Azure pipeline build.
For those with me so far, the VS Build step I have in my pipeline uses the following parameters:
/p:OutDir="$(Build.ArtifactStagingDirectory)\$(BuildConfiguration)" /p:WebPublishMethod=Package /p:SkipInvalidConfigurations=true /p:DeployTarget=Package /p:PackageRoot="$(Build.ArtifactStagingDirectory)\package"
After the build completes successfully, I find that the “umbraco” folder is correctly regenerated in the expected location for the source (i.e. the $(Build.SourcesDirectory)\UmbSolution\UmbProject\umbraco\**\*
folders) - so far so good. However, when I check the package temporary staging area, I find that the umbraco folder is missing!! All output from the build process gets placed into the following location (as per the OutDir parameter for MSBuild): $(Build.ArtifactStagingDirectory)\$(BuildConfiguration)\_PublishedWebsites\UmbProject
- under that base folder, I see the following folders:
\bin \config \css \Media \scripts \vendor \Views
Obviously, what’s not listed is the “Umbraco” folder - and that’s pretty important in getting everything to work!
Digging a lot deeper, I started looking at the various “target” files being used for the build process and seem to have spotted where things have gone awry and it does explain why the “umbraco” folder doesn’t get copied to the staging area. Skipping the many thousands of lines of log output related to the build, the process follows these process targets:
ValidateSolutionConfiguration
BeforeBuild
PrepareForBuild
CoreCompile
_CopyFilesMarkedCopyLocal
ScCollectAppFiles
_CopyOutOfDateSourceItemsToOutputDirectory
_CopyAppConfigFile
CopyFilesToOutputDirectory
CopyRoslynCompilerFilesToOutputDirectory
_CopyWebApplicationLegacy
CopyUmbracoFilesToWebRoot
The problem manifests itself due to the order in which the targets are being applied - in this case, the CopyUmbracoFilesToWebRoot
step executes after the _CopyWebApplicationLegacy
step has taken place, resulting in the “umbraco” folder being copied from the package area and into the build area after the built solution has already been copied out to the packaging staging area.
My question is (and apologies for it taking this long!): how do I go about making the build process work as I want it to and include the “umbraco” folder from the NuGet package as part of the Azure pipeline build process?
My own “idea” is to include a separate step in the build pipeline that goes into the staging area and copies that missing “umbraco” folder into the packaging staging area - but that feels a bit clunky. I firmly believe there’s a more elegant solution to be had, but right now, I can’t see it.
Many thanks!
This is a companion discussion topic for the original entry at https://our.umbraco.com/forum/105765-deployment-problems-using-an-azure-pipeline