How to resolve an old version of the same project in a single project build

I need to be able to declare a dependency on an older version of the same project in a single project build in order to compare their APIs for for compatibility. I have tried every option I can think find including numerous rounds with ChatGPT that ended up saying it is impossible to do it without creating a separate build. Creating a detachedConfiguration and simply specifying a normal dependency on the old version works for a multi-project build, but that same idiom always fails on a single project with an error:
> A dependency was declared on configuration 'default' which is not declared in the descriptor for project :.

Can anyone provide or point me at a mechanic to properly resolve a configuration that points to an older version of the same project in a single project build?