Our highest priority when designing the NCover 4 installer was to make it “just work” in the simplest way possible. Yes, yes, I know there are a ton of options and differing opinions on how much control users want over the installation. I’m not suggesting we should eliminate control, simply that most users don’t deal with visual clutter very well, and being presented with a feature they don’t need at that moment is an obstacle to their success. What we expect is that more technically demanding users are more willing to specify the advanced options on the command line. As a result, we don’t create an overly verbose interface for those who do not have the same exacting requirements, especially since these options are preserved for all future updates to the software on that machine.
Indeed, much of what we strive to accomplish with NCover 4 has the same intent of lowering the amount of product knowledge required to get that first coverage data in the bag so the user gets results. Many customers are using NCover for the first time and these changes have helped to make that possible. We do have long-time customers who know exactly how NCover works already and they prefer the old-fashioned way. That’s all good. We’re working to make both groups successful.
One of the largest changes with NCover 4 is the global setup of the profiler. In NCover 3, global setup was possible, but not common. In NCover 4, by default, the environment of the machine is modified to make the NCover coverage profiler work at all times. That’s preferable for some customers, but others require a greater level of control. We have exposed some additional installer options that will modify the default installer behavior. I want to highlight two new options which have been added to all of the installers for NCover: –global-env and –restore-point .
–global-env
The installer default is to register the COM visible profiler DLLs and to set up the environment variables that are necessary to profile any .Net process as it starts in Windows. Not every environment requires system-wide profiling. There are cases like the one described in “Isolating NCover Code Coverage…” which would work effortlessly if the profiler were a bit less pervasive. To configure a machine to remove the global profiler setup for the current install and all updates, simply execute the installer from a command prompt specifying –global-env=false. There will be no noticeable feedback in the GUI with this option, but the setting is retained for all subsequent updates, so it must be specified just this once..
Specifying –global-env without a value is the same as specifying –global-env=true. This setting can be used to reset the default installer behavior to global registration on a machine that has previously used –global-env=false.
–restore-point
By default, the NCover installers create a system restore point before the installation. This preserves the system settings that may be affected when the global environment is modified by NCover. Thus preserving settings for those rare, but all too costly times when an install changes the way a machine behaves. When installing via the GUI you will see the restore point getting created with the following screen display:
The time to create a system restore point varies widely from machine to machine. Creating a restore point by default is intended to help protect the integrity of the user’s machine and has become an expected behavior in many cases. Still, it may be overkill for your environment, or you may just not like waiting. In this case, some of us will want to turn off restore point creation. This little switch helps fast-track the installation.
NCover.Desktop-4.1.xxxx.xxx.exe /r=false
More installer options
A brief description of all installer options can be generated by adding /h, /help, /? to the command line for any of the NCover installers.
ex. NCover.Desktop-4.1.xxxx.xx.exe /?
Some of my favorites:
- /i – unattended install (no prompts)
- /u – unattended uninstall
- /x=<folder> – extract software to a folder without installing
- /dest=<folder> – destination for custom install folder
Does –global-env=false also change the state of the machine when a previous installer was run with –global-env=true?
The short answer is yes. It will change the global configuration even if it has been installed as –global-env=true in the past. That is because each new installation automatically uninstalls the previous copy of NCover. The uninstall removes the global registration from the previous installation.
HOWEVER: The Code Central uninstall does not do this for all previous versions and you may need to clear the environment manually.
Manually clearing global registration:
1) Remove the following environment variables:
COR_ENABLE_PROFILING
COR_PROFILER
CORECLR_ENABLE_PROFILING
CORECLR_PROFILER
2) Open an elevated command prompt and navigate to the install location for NCover then unregister the DLLs:
regsvr32 NCover.Launcher.x86.dll /u
regsvr32 NCover.Coverage.x86.dll /u
and on 64-bit machines also the following:
regsvr32 NCover.Launcher.x64.dll /u
regsvr32 NCover.Coverage.x64.dll /u