Beispiel #1
0
    public override void StripSymbols(FileReference SourceFile, FileReference TargetFile)
    {
        bool bStripInPlace = false;

        if (SourceFile == TargetFile)
        {
            // PDBCopy only supports creation of a brand new stripped file so we have to create a temporary filename
            TargetFile    = new FileReference(Path.Combine(TargetFile.Directory.FullName, Guid.NewGuid().ToString() + TargetFile.GetExtension()));
            bStripInPlace = true;
        }

        FileReference PdbCopyLocation;

        if (!TryGetPdbCopyLocation(out PdbCopyLocation))
        {
            throw new AutomationException("Unable to find installation of PDBCOPY.EXE, which is required to strip symbols. This tool is included as part of the 'Windows Debugging Tools' component of the Windows 10 SDK (https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk).");
        }

        ProcessStartInfo StartInfo = new ProcessStartInfo();

        StartInfo.FileName        = PdbCopyLocation.FullName;
        StartInfo.Arguments       = String.Format("\"{0}\" \"{1}\" -p", SourceFile.FullName, TargetFile.FullName);
        StartInfo.UseShellExecute = false;
        StartInfo.CreateNoWindow  = true;
        Utils.RunLocalProcessAndLogOutput(StartInfo);

        if (bStripInPlace)
        {
            // Copy stripped file to original location and delete the temporary file
            File.Copy(TargetFile.FullName, SourceFile.FullName, true);
            FileReference.Delete(TargetFile);
        }
    }
		/// <summary>
		/// Helper function to get the console app BinaryName-Cmd.exe filename based on the binary filename.
		/// </summary>
		/// <param name="BinaryPath">Full path to the binary exe.</param>
		/// <returns></returns>
		public static FileReference GetAdditionalConsoleAppPath(FileReference BinaryPath)
		{
			return FileReference.Combine(BinaryPath.Directory, BinaryPath.GetFileNameWithoutExtension() + "-Cmd" + BinaryPath.GetExtension());
		}
Beispiel #3
0
    public override void StripSymbols(FileReference SourceFile, FileReference TargetFile)
    {
        bool bStripInPlace = false;

        if (SourceFile == TargetFile)
        {
            // PDBCopy only supports creation of a brand new stripped file so we have to create a temporary filename
            TargetFile    = new FileReference(Path.Combine(TargetFile.Directory.FullName, Guid.NewGuid().ToString() + TargetFile.GetExtension()));
            bStripInPlace = true;
        }

        ProcessStartInfo StartInfo   = new ProcessStartInfo();
        string           PDBCopyPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "MSBuild", "Microsoft", "VisualStudio", "v14.0", "AppxPackage", "PDBCopy.exe");

        if (!File.Exists(PDBCopyPath))
        {
            // Fall back on VS2013 version
            PDBCopyPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "MSBuild", "Microsoft", "VisualStudio", "v12.0", "AppxPackage", "PDBCopy.exe");
        }
        StartInfo.FileName        = PDBCopyPath;
        StartInfo.Arguments       = String.Format("\"{0}\" \"{1}\" -p", SourceFile.FullName, TargetFile.FullName);
        StartInfo.UseShellExecute = false;
        StartInfo.CreateNoWindow  = true;
        Utils.RunLocalProcessAndLogOutput(StartInfo);

        if (bStripInPlace)
        {
            // Copy stripped file to original location and delete the temporary file
            File.Copy(TargetFile.FullName, SourceFile.FullName, true);
            FileReference.Delete(TargetFile);
        }
    }