Pull Request for publishing assets in HelixBase project
Note (26/june/2023): After writing this blog post, I found that there is a pending PR by someone else that is yet to be merged: https://github.com/muso31/Helixbase/pull/62 but this post will be useful to understand a problem and associated solution + some HPP and CPM basics .
There are so many people who have raved about Sitecore Slack. So, I won't delve into it. Recently, one of our buddy-developers was having a weird issue with the Sitecore Helixbase project and had stated they were unable to do proper VS publish with the HelixBase project. I then went through the issue logged in the repo.
Frankly, I didn't have much background about Helix Publish Pipeline(HPP) but no guts no glory. When I cloned the repo, created a publish profile and published to a local directory, this is what I saw:
If you are eagle-eyed, you will notice that although there are config files in the sln structure, they are nowhere to be seen in the published folder.
As a very smart developer, I changed the "Copy to output Directory" property of one of the config files to Copy if Newer unaware that Helix Publish Pipeline treats this a different way wherein it publishes the config file under bin\App_Config folder as follows:
Since this is not the desired end-result, I started investigating: My search for any such issues in the past hit a dead-end. I also tried for ways to intercept the publish pipeline (msbuild tasks!) to either delete the App_Config under the bin folder or altogether bypass it someway. I could plugin tasks in the build process but not the publish process. I also thought of (somehow!) invoking a PS script that can do the delete job but everything seemed a hack and most importantly, nothing worked!
Then, I took a step back and revisited the github issue to realise that the issue started happening after switching over to central package management (CPM). I then analysed CPM (diagram below). After closing doors one after another I narrowed down to this suspicious setting:
I changed PackageVersion to PackageReference, did a publish and that worked:
Comments
Post a Comment