After following the various methods proposed by the responders, I found that this procedure works:
First make a new directory in parallel to the existing example project. For example, I took:
C:\ST\STM32Cube_FW_WB_V1.24.0\Projects\P-NUCLEO-WB55.Nucleo\Applications\BLE\BLE_HeartRateFreeRTOS
and made the parallel using my initials to make it different:
C:\ST\STM32Cube_FW_WB_V1.24.0\Projects\P-NUCLEO-WB55.Nucleo\Applications\BLE\DJP_HeartRateFreeRTOS
Copy the files under the old into the new - all of them.
In the new area, find the ioc file and rename it to match the new directory.
Inside the ioc file edit (in text mode) change all occurrences of the old into the new. In my case, there were three occurrences.
At this point you should be able to pull up STM32CubeIDE and compile and run. This is just a check that nothing is broken.
Now pull up STM32CubeMX with the new ioc file. Under the Project Manager → Code Generator tab, select either of the bullets that copy the library files. It is important to remove the “library files as references”. (While there, check that the blocks in the “Generated files” section are what you want. I like the peripheral files as separate ‘c’ and ‘h’ files, but that’s just a personal preference.)
Now, click on [Generate Code], recompile and verify it still works.
At this point, just copy the entire ‘new’ directory structure to wherever you want. Point the tools (MX or IDE) to these new area and it should “Just work.”
Two added notes:
I found that trying to generate the application using MX either required that I fill everything out or one file (hrs_app.c) was corrupt and I had to manually copy it from the original location. For this example, I found using MX was just frustrating!
Also, the same file seems to be affected whenever code is regenerated. This is something that’s beyond me. I haven’t tried this since I moved the project to the new directory, so this may be a fluke.