This is a basic example of providing a managed COM server in .NET Core 3.0. Documentation on the inner workings of activation can be found here.
Demonstrates how to provide a COM server in .NET Core 3.0 Preview 7 or later.
Additional comments are contained in source and project files.
The project will only build and run on the Windows platform. You can build and run the example either by registering the COM server or by using registration-free COM.
-
Install .NET Core 3.0 Preview 7 or later.
-
Navigate to the root directory and run
dotnet.exe build
. -
Follow the instructions for COM server registration that were emitted during the build.
-
Navigate to
COMClient/
and rundotnet.exe run
.
Program should output an estimated value of π.
Note Remember to unregister the COM server when the demo is complete.
-
Install .NET Core 3.0 Preview 7 or later.
-
Navigate to the root directory and run
dotnet.exe build /p:RegFree=True
.- If the Registered COM demo was previously run, the project should be cleaned first -
dotnet.exe clean
- If the Registered COM demo was previously run, the project should be cleaned first -
-
Run the generated binary directly. For example,
COMClient\bin\Debug\netcoreapp3.0\COMClient.exe
.
Program should output an estimated value of π.
Note The RegFree COM scenario requires a customized application manifest in the executing binary. This means that attempting to execute through dotnet.exe
will not work and instead trigger a rebuild of the project.
Note Running the "Registered COM" first and then immediately following it by "RegFree COM" will not work, since the build system will not correctly rebuild all files (the simple property change is not detected as a reason for a full rebuild). To fix this, run dotnet clean
between the two samples.