@@ -465,29 +465,42 @@ def prepare_and_start_backend(
465465 # Verify dotnet is installed
466466 import shutil
467467
468- if not shutil .which ("dotnet" ):
469- raise RuntimeError (
470- "Cannot find 'dotnet' command. "
471- "Please install 'dotnet' to use the Ansys Geometry Core Service. "
472- "At least dotnet 8.0 is required."
468+ if not any (
469+ CORE_GEOMETRY_SERVICE_EXE .replace (".exe" , "" ) in file .name
470+ for file in Path (root_service_folder ).iterdir ()
471+ ):
472+ if not shutil .which ("dotnet" ):
473+ raise RuntimeError (
474+ "Cannot find 'dotnet' command. "
475+ "Please install 'dotnet' to use the Ansys Geometry Core Service. "
476+ "At least dotnet 8.0 is required."
477+ )
478+ # At least dotnet 8.0 is required
479+ # private method and controlled input by library - excluding bandit check.
480+ if (
481+ subprocess .check_output (["dotnet" , "--version" ]).decode ("utf-8" ).split ("." )[0 ] # nosec B607, B603
482+ < "8"
483+ ):
484+ raise RuntimeError (
485+ "Ansys Geometry Core Service requires at least dotnet 8.0. "
486+ "Please install a compatible version."
487+ )
488+ # For Linux, we need to use the dotnet command to launch the Core Geometry Service
489+ args .append ("dotnet" )
490+ args .append (
491+ Path (
492+ root_service_folder ,
493+ CORE_GEOMETRY_SERVICE_EXE .replace (".exe" , ".dll" ),
494+ )
473495 )
474-
475- # At least dotnet 8.0 is required
476- # private method and controlled input by library - excluding bandit check.
477- if subprocess .check_output (["dotnet" , "--version" ]).decode ("utf-8" ).split ("." )[0 ] < "8" : # nosec B607, B603
478- raise RuntimeError (
479- "Ansys Geometry Core Service requires at least dotnet 8.0. "
480- "Please install a compatible version."
481- )
482-
483- # For Linux, we need to use the dotnet command to launch the Core Geometry Service
484- args .append ("dotnet" )
485- args .append (
486- Path (
487- root_service_folder ,
488- CORE_GEOMETRY_SERVICE_EXE .replace (".exe" , ".dll" ),
496+ else :
497+ # For Linux, we need to use the exe file to launch the Core Geometry Service
498+ args .append (
499+ Path (
500+ root_service_folder ,
501+ CORE_GEOMETRY_SERVICE_EXE .replace (".exe" , "" ),
502+ )
489503 )
490- )
491504 else :
492505 raise RuntimeError (
493506 f"Cannot connect to backend { backend_type .name } using ``prepare_and_start_backend()``"
0 commit comments