Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Service Support

Shaun Wilde edited this page Sep 5, 2015 · 1 revision

Note that .zip and .nuget packages (at least) will not ACL files so that a low-privilege service can execute them -- manually add the service principal with read/execute privilege to the OpenCover.Profiler.dll ACLs, either through explorer properties or by a Get-Acl/Set-Acl PowerShell script.

Launching the profiling operation must be done with Administrator privilege -- this is required to even start the service, and is also needed to create the global objects and set the per-service environment that registers the COM object. Assuming that the COM objects have been pre-registered, the command line to use is like

OpenCover.console.exe -service:byname -target:<service name> -output:coverage.xml

As this is a blocking operation, launching the coverage gathering a separate process as

start-process OpenCover.console.exe @("-target:<service name>", "-service:byName", "-output:<service name>coverage.xml")

or equivalent in your test scripts.

The byname qualifier is used to prevent races if multiple services are being started concurrently by injecting the OpenCover profiling information to the service specific environment.