I'm finally trying to kick the crutch of developing using an account with admin privileges. That same account was my regular account for day to day use, too. I’ve always known it’s a really, really stupid thing to be doing (see LeBlanc and Howard, Brown, or talk with any long time Unix user who will rightfully heap scorn upon you), but I just went with the path of least resistance. Hey, I quit a two-pack a day smoking habit. How hard can it be to kick this admin account thing?
Today I ran into my first small hitch while trying to get finicky NCover working for something I’m writing. NCover’s very tempermental with its command-line parameters, so you really need to run it from a batch file or NAnt task. I was trying to get an old NAnt build file working and was running into issues where everything appeared to work nicely, but no coverage report was being generated. Arrgghhh.
I’d run into this in the past where NCover’s support library CoverLib.dll would lose its mind and require re-registration. It was so nasty that I just added an exec for registering that library into my NAnt task — it re-registers itself every time the dang coverage runs.
So back to the admin/non-admin issue: regsvr32 will appear to execute just fine to register a DLL if you’re running as a non-admin account, it just doesn’t really do anything. The DLL wasn’t successfully registered, and I got no feedback that the process failed.
Quick answer? Use the “runas” to spawn another command window for executing my NAnt task. This second window was spawned as one of my admin accounts. Voila!