Exemplo n.º 1
0
    public static bool TryGetPdbCopyLocation(out FileReference OutLocation)
    {
        // Try to find an installation of the Windows 10 SDK
        string SdkInstallFolder =
            (Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER\\Software\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot10", null) as string) ??
            (Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot10", null) as string) ??
            (Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER\\Software\\Wow6432Node\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot10", null) as string) ??
            (Microsoft.Win32.Registry.GetValue("HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows Kits\\Installed Roots", "KitsRoot10", null) as string);

        if (!String.IsNullOrEmpty(SdkInstallFolder))
        {
            FileReference Location = FileReference.Combine(new DirectoryReference(SdkInstallFolder), "Debuggers", "x64", "PDBCopy.exe");
            if (FileReference.Exists(Location))
            {
                OutLocation = Location;
                return(true);
            }
        }

        // Look for an installation of the MSBuild 14
        FileReference LocationMsBuild14 = FileReference.Combine(DirectoryReference.GetSpecialFolder(Environment.SpecialFolder.ProgramFilesX86), "MSBuild", "Microsoft", "VisualStudio", "v14.0", "AppxPackage", "PDBCopy.exe");

        if (FileReference.Exists(LocationMsBuild14))
        {
            OutLocation = LocationMsBuild14;
            return(true);
        }

        // Look for an installation of the MSBuild 12
        FileReference LocationMsBuild12 = FileReference.Combine(DirectoryReference.GetSpecialFolder(Environment.SpecialFolder.ProgramFilesX86), "MSBuild", "Microsoft", "VisualStudio", "v12.0", "AppxPackage", "PDBCopy.exe");

        if (FileReference.Exists(LocationMsBuild12))
        {
            OutLocation = LocationMsBuild12;
            return(true);
        }

        // Otherwise fail
        OutLocation = null;
        return(false);
    }
Exemplo n.º 2
0
    public static bool TryGetPdbCopyLocation(out FileReference OutLocation)
    {
        // Try to find an installation of the Windows 10 SDK
        List <KeyValuePair <string, DirectoryReference> > WindowsSdkDirs = WindowsExports.GetWindowsSdkDirs();

        foreach (DirectoryReference WindowsSdkDir in WindowsSdkDirs.Select(x => x.Value))
        {
            FileReference PdbCopyExe = FileReference.Combine(WindowsSdkDir, "Debuggers", "x64", "PdbCopy.exe");
            if (FileReference.Exists(PdbCopyExe))
            {
                OutLocation = PdbCopyExe;
                return(true);
            }
        }

        // Look for an installation of the MSBuild 14
        FileReference LocationMsBuild14 = FileReference.Combine(DirectoryReference.GetSpecialFolder(Environment.SpecialFolder.ProgramFilesX86), "MSBuild", "Microsoft", "VisualStudio", "v14.0", "AppxPackage", "PDBCopy.exe");

        if (FileReference.Exists(LocationMsBuild14))
        {
            OutLocation = LocationMsBuild14;
            return(true);
        }

        // Look for an installation of the MSBuild 12
        FileReference LocationMsBuild12 = FileReference.Combine(DirectoryReference.GetSpecialFolder(Environment.SpecialFolder.ProgramFilesX86), "MSBuild", "Microsoft", "VisualStudio", "v12.0", "AppxPackage", "PDBCopy.exe");

        if (FileReference.Exists(LocationMsBuild12))
        {
            OutLocation = LocationMsBuild12;
            return(true);
        }

        // Otherwise fail
        OutLocation = null;
        return(false);
    }