Skip to content

Need to address SDK folder location with AOT #52987

@JeremyKuhne

Description

@JeremyKuhne

When we look for folders, we can't use assembly location as a root as the assembly doesn't exist in the same way when we're precompiled into a single executable with AOT. For example (BuiltInTemplatePackageProvider.GetTemplateFolders):

#pragma warning disable IL3000 // Avoid accessing Assembly file path when publishing as a single file
        var sdkDirectory = Path.GetDirectoryName(typeof(Utils.DotnetFiles).Assembly.Location);
#pragma warning restore IL3000

        var dotnetRootPath = Path.GetDirectoryName(Path.GetDirectoryName(sdkDirectory));

        // First grab templates from dotnet\templates\M.m folders, in ascending order, up to our version
        string templatesRootFolder = Path.GetFullPath(Path.Combine(dotnetRootPath, "templates"));

Another in OptionalWorkloadProvider.GetAllTemplatePackagesAsync:

#pragma warning disable IL3000 // Avoid accessing Assembly file path when publishing as a single file
        var sdkDirectory = Path.GetDirectoryName(typeof(DotnetFiles).Assembly.Location);
#pragma warning restore IL3000 // Avoid accessing Assembly file path when publishing as a single file
        var sdkVersion = Path.GetFileName(sdkDirectory);
        var dotnetRootPath = Path.GetDirectoryName(Path.GetDirectoryName(sdkDirectory));
        string userProfileDir = CliFolderPathCalculator.DotnetUserProfileFolderPath;

        var packages = optionalWorkloadLocator.GetDotnetSdkTemplatePackages(sdkVersion, dotnetRootPath, userProfileDir);

@baronfel has a PR that relates to this: #52665

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-dotnet AOTItems that are part of the dotnet CLI AOT-ification effortuntriagedRequest triage from a team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions