Search code examples
visual-studio-2010windows-installersetup-deploymentbootstrapper

Windows Installer Bootstrappers - permissions


I have custom bootstrappers for SQL Server 2008 R2, .NET Framework 3.5, .NET Framework 4, etc. I am using Visual STudio 2010's Deployment project to deploy a .NET 4 application. I know these are going away.

Is there a way I can specify a bootstrapper to Fail if the user does not have specific Windows Privledges? SQL Server's Setup seems to take care of this on its own, but gives very cryptic error codes and texts that are hard to trace for users. I know that I can set Bypasses for Windows versions, and SqlCheck.exe performs some sort of version check. Would I have to create my own application that checks the user's permissions, and the bootstrapper could check the return code of that, similar to SqlCheck.exe?

Can this be accomplished using the Bootstrapper Manifest Generator, and is the BMG even supported by Visual Studio 2010? Appears to not be supported anymore, but I"m not sure if there's anything specific to VS 2010 / Windows Installer 4.5 http://archive.msdn.microsoft.com/bmg


Solution

  • The most you can do with the standard Visual Studio bootstrapper is to check the AdminUser property value. The predefined .NET Framework 4.0 Client Profile prerequisite uses a similar condition. You can find its manifest in this folder:

    C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\DotNetFX40Client
    

    This should also be supported by the bootstrapper manifest generator.

    But, and this is a big one, on newer Windows versions all users can get Administrator privileges through elevation. So from the installer point of view, any user is seen as an Administrator, even if he's not.

    So this approach is pretty much useless on Vista or higher.

    You could try creating your own custom EXE bootstrapper which handles prerequisites and checks user privileges. But you will most likely encounter the same problem.

    From my experience, the best approach is to let each installer elevate itself if necessary. Most of them have built-in mechanisms for this, especially the ones from Microsoft.

    If you encounter problems with this approach, I'm pretty sure they are not caused by privileges. Most likely your prerequisite is not configured correctly (for example an incorrect command line).