Upgrading Microsoft.Office.Interop in C# .NET application

Robottom, John 0 Reputation points
2024-06-04T16:10:36.39+00:00

We have older versions of Microsoft.Office.Interop (Word, Excel) in our application and we want to upgrade to a more recent version. For Microsoft.Office.Interop.Word, it appears that we have version 11.0.0.0 (runtime version v1.1.4322) when I look at the Properties of a reference to Microsoft.Office.Interop.Word in one of our C# Projects.
For Microsoft.Office.Interop.Excel, it appears that we have version 1.6.0.0 (no runtime version indicated) when I look at the Properties of a reference to Microsoft.Office.Interop.Excel in one of our C# Projects.

We need to check if, for a given method of Microsoft.Office.Interop.Word or Microsoft.Office.Interop.Excel, the signature has changed in the version of that Microsoft library.

We need to upgrade to the latest version. So, in our C# Projects, we want to replace the references we have with references to the latest version (having installed the latest version, of course). Rather than doing this blindly, we want to know if any of the method calls in the version we currently have have changes to their signatures or attributes, in the latest version.

Rather than doing this manually, is there some automated way to compare the method signatures of a given version of Microsoft.Office.Interop.Word/Excel to another version?
Or, is there some Microsoft documentation that lists differences?

Doing this analysis manually is very tedious and error-prone.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,654 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Jiale Xue - MSFT 43,046 Reputation points Microsoft Vendor
    2024-06-05T08:44:24.0466667+00:00

    Hi @Robottom, John , Welcome to Microsoft Q&A,

    The versions of Microsoft.Office.Interop.Word and Microsoft.Office.Interop.Excel may be different.

    Microsoft's official documentation site (docs.microsoft.com) provides detailed documentation about the Office interop assemblies, including how to use these libraries and some sample code, but does not specifically list the version differences.

    ApiPort is a tool provided by Microsoft that can generate API compatibility reports to help you understand the changes in APIs between different versions.

    Steps:

    1. Download and install ApiPort.
    2. Run the following command to generate a report:
    ApiPort analyze -f "path\to\old\Microsoft.Office.Interop.Word.dll" -t ".NET Framework, Version=latest" -r ExcelInteropDiffs.txt
    ApiPort analyze -f "path\to\new\Microsoft.Office.Interop.Word.dll" -t ".NET Framework, Version=latest" -r WordInteropDiffs.txt
    
    
    1. View the generated report file and check the changes in method signatures.

    There is no fully automated method, so it is better to do a manual comparison for a single program.Best Regards,

    Jiale


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.