When you open a project package, either from a local drive or the active portal, the package is unpacked and the project file (*.aprx) it contains is opened by ArcGIS Pro. This property gets the location of the currently open project file, not the URI of the original project package.
{
//Gets the location of the current project; that is, the path to the current project file (*.aprx)
projectPath = Project.Current.URI;
// Use projectPath
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)