.NET Core 2.0 WebAPI with .NET Framework 4.6( for COM interoperability)

The problem :

I want some .NET Core Web API in Kestrel mode that have access to some COM components ( such as Word.Application )


( Theory : in order to have dll’s that works in .NET Framework application and in .NET Core, you should have .NET Standard 2.0 along .NET Framework 4.6.1 and .NET Core 2.0 ( see https://docs.microsoft.com/en-us/dotnet/standard/net-standard )

Step 1 :  create the .NET 4.6.1 dll that access the COM object

Step 2: create the .NET WEB API application. Edit the .csproj file and replace the target framework with


Save the .csproj

Step 3 ; Remove the Microsoft.AspNetCore.All metapackage and install yours . For me it was enough to install those 3:

install-package microsoft.aspnetcore.mvc

install-package Microsoft.AspNetCore

install-package Microsoft.AspNetCore.Diagnostics

( you may want to add CORS and/or others)

Step 4: run

dotnet restore


dotnet build

Step 5: Reference the dll that you have created in the Step 1  and reference from a controller action. Build again.

Step 6; Check that you have now an exe file in build / debug / net461. You can run this exe / deploy in IIS /