diff --git a/doc/changelog.d/2226.added.md b/doc/changelog.d/2226.added.md new file mode 100644 index 0000000000..c7624826b3 --- /dev/null +++ b/doc/changelog.d/2226.added.md @@ -0,0 +1 @@ +For 261 dotnet 8 is included in core service diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index 74d4f12cdc..99c0e90a84 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -465,29 +465,42 @@ def prepare_and_start_backend( # Verify dotnet is installed import shutil - if not shutil.which("dotnet"): - raise RuntimeError( - "Cannot find 'dotnet' command. " - "Please install 'dotnet' to use the Ansys Geometry Core Service. " - "At least dotnet 8.0 is required." + if not any( + CORE_GEOMETRY_SERVICE_EXE.replace(".exe", "") in file.name + for file in Path(root_service_folder).iterdir() + ): + if not shutil.which("dotnet"): + raise RuntimeError( + "Cannot find 'dotnet' command. " + "Please install 'dotnet' to use the Ansys Geometry Core Service. " + "At least dotnet 8.0 is required." + ) + # At least dotnet 8.0 is required + # private method and controlled input by library - excluding bandit check. + if ( + subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] # nosec B607, B603 + < "8" + ): + raise RuntimeError( + "Ansys Geometry Core Service requires at least dotnet 8.0. " + "Please install a compatible version." + ) + # For Linux, we need to use the dotnet command to launch the Core Geometry Service + args.append("dotnet") + args.append( + Path( + root_service_folder, + CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ".dll"), + ) ) - - # At least dotnet 8.0 is required - # private method and controlled input by library - excluding bandit check. - if subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] < "8": # nosec B607, B603 - raise RuntimeError( - "Ansys Geometry Core Service requires at least dotnet 8.0. " - "Please install a compatible version." - ) - - # For Linux, we need to use the dotnet command to launch the Core Geometry Service - args.append("dotnet") - args.append( - Path( - root_service_folder, - CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ".dll"), + else: + # For Linux, we need to use the exe file to launch the Core Geometry Service + args.append( + Path( + root_service_folder, + CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ""), + ) ) - ) else: raise RuntimeError( f"Cannot connect to backend {backend_type.name} using ``prepare_and_start_backend()``"