简体   繁体   English

Visual Studio安装项目 - 作为系统帐户运行

[英]Visual Studio setup project - running as system account

I created a new Visual Studio Setup project with VS 2008. 我用VS 2008创建了一个新的Visual Studio安装项目。

I use it to install SQLExpress. 我用它来安装SQLExpress。 The installatino of SQLExpress works fine when I do it manually outside of the installer. 当我在安装程序外手动执行时,SQLExpress的installatino工作正常。

But when I install, I get an error in SQL Express with permissions. 但是当我安装时,我在SQL Express中获得了权限错误。 I found out that it's because the SQLExpress process is running as the System account when I run it from my setup project. 我发现这是因为当我从我的安装项目运行时,SQLExpress进程作为系统帐户运行。

I tried starting the process both via custom actions and via C# code that runs after a module is installed via Process.Start. 我尝试通过自定义操作和通过Process.Start安装模块后运行的C#代码启动该过程。 But both of them run the SQLExpress process as the System account. 但是它们都以SQLExpress进程作为系统帐户运行。

What can I do to run this process instead as the currently logged on user? 作为当前登录的用户,我该怎么做才能运行此流程?

Note: I also tried to start calc.exe and that runs as the system process as well. 注意:我也尝试启动calc.exe,它也作为系统进程运行。 Why won't it run under the context of the same user as my installer is running as? 为什么它不会在我的安装程序运行的同一用户的上下文中运行?

If you want to install SQL Server Express as a prerequisite to your application you should add it as a prerequisite to you Setup and Deployment project. 如果要将SQL Server Express作为应用程序的先决条件安装,则应将其作为安装和部署项目的先决条件添加。

This can be done by right-clicking on your setup project, then choosing Properties -> Prerequisites and then checking SQL Server Express 2008 . 这可以通过右键单击安装项目,然后选择“ 属性” - >“先决条件” ,然后选中“ SQL Server Express 2008”来完成

Note that in order to have SQL Server Express available in the list of prerequisites it must be installed on your development machine. 请注意,为了使SQL Server Express在先决条件列表中可用,必须在开发计算机上安装它。

Update: 更新:

If you want to specify an instance name there is no way around manually editing the bootstrapper package definition. 如果要指定实例名称,则无法手动编辑引导程序包定义。

For Visual Studio 2008 the bootstrapper packages are placed in the following location by default: 对于Visual Studio 2008,默认情况下,引导程序包将放置在以下位置:

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

There you will also find a folder names SqlExpress . 在那里你还会找到一个名为SqlExpress的文件夹。 Within that folder, open the file en\\package.xml and modify the command line arguments for the installer. 在该文件夹中,打开文件en \\ package.xml并修改安装程序的命令行参数。 There are three sections depending on the target OS (Win 2000, XP and 2003+): 根据目标操作系统有三个部分(Win 2000,XP和2003+):

<Command PackageFile="sqlexpr32.exe" 
         Arguments="-q /norebootchk /qn reboot=ReallySuppress addlocal=all 
                    instancename=SQLEXPRESS SQLAUTOSTART=1 ADDUSERASADMIN=1" 
                    EstimatedInstalledBytes="225000000" 
                    EstimatedTempBytes="225000000" 
                    EstimatedInstallSeconds="420">

   ...

</Command>

This change will affect all installers with this package as a prerequisite that are build on your system. 此更改将影响具有此程序包的所有安装程序,作为在系统上构建的先决条件。 If you don't want that you would have to create your own separate bootstrapper package by copying the SqlExpress folder and updating the ProductCode in SqlExpress\\package.xml. 如果您不希望通过复制SqlExpress文件夹并更新SqlExpress \\ package.xml中的ProductCode,则必须创建自己的独立引导程序包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio安装项目:将CustomActions / process作为当前用户而不是系统帐户运行 - Visual Studio setup project: run CustomActions/process as current user not system account Visual Studio安装项目 - Visual Studio Setup Project 作为Visual Studio 2010安装项目的一部分运行SQL脚本 - Running SQL script as part of visual studio 2010 Setup Project Visual Studio 2008安装项目 - Visual Studio 2008 Setup Project 安装项目Visual Studio和Nuget - Setup project Visual Studio and Nuget Visual Studio安装项目冻结 - Visual Studio setup project freezes 错误1001 system.badimageformatexception无法在创建安装项目Visual Studio 2013时加载文件或程序集 - Error 1001 system.badimageformatexception could not load file or assembly on creation of a setup project visual studio 2013 Visual Studio安装程序部署项目-如何指定文件系统安装文件夹 - Visual Studio Setup Deployment Project - How to Specify File System Installation Folder Visual Studio项目无法正常运行 - Visual Studio Project Not Running properly C#-使用Visual Studio安装项目安装时,在LocalSystem下运行的Windows Service提示输入凭据 - C# - Windows Service running under LocalSystem is prompting for credentials when installing using Visual Studio setup project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM