
It's not using NuGet. It is using COM interop. Therefore the COM object (Office in this case) would have been installed on the development machine and then it can be referenced directly. At build time the compiler loads the typelib for the COM object and generates the necessary interop code and then inserts it into the assembly rather than requiring a separate assembly.
If you want to switch to using NuGet (recommended) then you'll need to do the following.
- Remove the COM reference from the project.
- Add a reference to the NuGet package for the lowest version of Office you need to work against.
- Fix up any compiler errors caused by switching from the raw COM reference to the wrapper NuGet package. It might be as simple as adjusting namespaces (COM references had a weird syntax).
Note that in order to run this code you're still going to need to have Office installed so switching to NuGet would only really be helpful if you are trying to build on a build server that doesn't have Office installed. I would personally still recommend using NuGet instead of COM but it'll fail at runtime without Office installed.