How to use dotnetcore2 - 2 common examples

To help you get started, we’ve selected a few dotnetcore2 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / NimbusML / src / python / nimbusml / internal / utils / utils.py View on Github external
def get_clr_path():
    """
    Return path to .NET CLR binaries.
    Use dotnetcore2 package if Python 3.x, otherwise look for libs bundled with
    NimbusML.
    """
    if six.PY2:
        return get_mlnet_path()
    else:
        from dotnetcore2 import runtime as clr_runtime
        libs_root = os.path.join(clr_runtime._get_bin_folder(), 'shared', 
                                'Microsoft.NETCore.App')

        # Search all libs folders to find which one contains the .NET CLR libs
        libs_folders = os.listdir(libs_root)
        if len(libs_folders) == 0:
            raise ImportError("Trouble importing dotnetcore2: "
                                "{} had no libs folders.".format(libs_root))
        clr_path = None
        for folder in libs_folders:
            if os.path.exists(os.path.join(libs_root, folder, 
                                           'Microsoft.CSharp.dll')):
                clr_path = os.path.join(libs_root, folder)
                break
        if not clr_path:
            raise ImportError(
                "Trouble importing dotnetcore2: Microsoft.CSharp.dll was not "
github microsoft / NimbusML / src / python / nimbusml / internal / utils / utils.py View on Github external
def set_clr_environment_vars():
    """
    Set system environment variables required by the .NET CLR.
    Python 3.x only, as dotnetcore2 is not available for Python 2.x.
    """
    if six.PY2:
        pass
    else:
        from dotnetcore2 import runtime as clr_runtime
        dependencies_path = None
        try: 
            # try to resolve dependencies, specifically libunwind for Linux
            dependencies_path = clr_runtime.ensure_dependencies()
        except:
            pass
        # Without this, Linux versions would require the ICU package
        os.environ['DOTNET_SYSTEM_GLOBALIZATION_INVARIANT'] = 'true'
        # Will be None for Windows
        if dependencies_path is not None:
            os.environ['LD_LIBRARY_PATH'] = dependencies_path

dotnetcore2

.Net Core 3.1 runtime

MIT
Latest version published 3 years ago

Package Health Score

79 / 100
Full package analysis

Similar packages