.NET applications are loaded, executed, and managed by the CLR. We use the term unmanaged to refer to any code that is outside the control of the CLR.
If a .NET developer needs to interact with unmanaged code, they can use two technologies: Component Object Model (COM) Interop and Platform Invoke (also known as P/Invoke).
Tip
Both of these technologies are specific to Windows and, therefore, are only supported by the .NET Framework, not by the .NET Core.
Most of the popular Microsoft Office products support being automated using COM. If you have Microsoft Excel (for Windows) installed, then you can complete this exercise.
Add a new console application project named Ch05_AutomatingExcel. In the Solution Explorer window, right-click on References and choose Add Reference….
In the Reference Manager window, on the left-hand side, click on COM, and then select the checkbox for Microsoft Excel 16.0 Object Library (or the...