How to save/print "Compare with ..." output in Visual Studio?

Steiner, Thomas 0 Reputation points
2025-02-01T00:00:07.2133333+00:00

Need to store code changes for each application change that will occur.

Visual Studio 2022 "Compare with ..." produces the output I need to store but I don't know a way to print/export (save to a file) the compare window. Screenshots are not an option allowed by the auditors.

Any suggestions/instructions greatly appreciated!

Screenshot.jpg

Developer technologies Visual Studio Testing
Developer technologies Visual Studio Setup
Developer technologies Visual Studio Other
{count} votes

1 answer

Sort by: Most helpful
  1. Jonathan Pereira Castillo 17,095 Reputation points Microsoft External Staff Moderator
    2025-02-01T00:18:19.48+00:00

    Steiner, Thomas To save or print the "Compare with ..." output in Visual Studio 2022, you can follow these steps:

    1. Use the Command Line:
      • Open the Developer Command Prompt for Visual Studio.
      • Use the devenv /Diff command to compare the two files and save the output:
             devenv /Diff SourceFile TargetFile [SourceDisplayName [TargetDisplayName]]
        
      • This will open the comparison in Visual Studio, where you can then copy the content to a file.
    2. Copy and Paste:
      • In the comparison window, you can select the text you want to save.
      • Copy the selected text (Ctrl+C) and paste it into a text editor (Ctrl+V) like Notepad or Visual Studio Code.
      • Save the file from the text editor.
    3. Use an Extension:
      • There are Visual Studio extensions available that can help with exporting comparison results. One such extension is "Save Compare Files" which allows you to save the comparison result directly to a file.
    4. Print to PDF:
      • If printing is allowed, you can use a PDF printer to print the comparison result to a PDF file.
      • In the comparison window, go to File > Print and select a PDF printer.
    5. Use a Script:
      • You can write a script to automate the comparison and saving process using Visual Studio's automation model (EnvDTE).

    These methods should help you save or print the "Compare with ..." output in Visual Studio 2022. Let me know if you need further assistance!

    Joanthan


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.