我正在使用InnoSetup创建一个安装包并安装SQL Server 2005 Express。以下是我的RUN部分中出现的以下代码:
Filename: "{app}\SQL Server 2005 Express\SQLEXPR.exe" ; Parameters: "-q /norebootchk /qn reboot=ReallySuppress addlocal=all INSTANCENAME=(LOCAL) SCCCHECKLEVEL=IncompatibleComponents:1;MDAC25Version:0 ERRORREPORTING=2 SQLAUTOSTART=1 SAPWD=passwordhere SECURITYMODE=SQL"; WorkingDir: {app}\SQL Server 2005 Express; StatusMsg: Installing Microsoft SQL Server 2005 Express... Please Wait...;Check:SQLVerifyInstall
我想要完成的是安装SQL Server软件包,但只有实例名称本身引用了机器名称的名称,仅此而已。我收到的是一个命名实例,而不是本地,例如 MachineName \ SQLEXPRESS,这不是我想要接收的。
我需要一个本地实例而不是命名实例,因为我的代码编写方式能够安装和讨论相关数据库。我会改变它,相信我,如果不是这个安装包是以前使用MSDE安装程序的包的替代品。我必须能够通过代码支持这两者。任何建议都是受欢迎的,但是一个简单明了的方法让安装程序只使用机器名安静地安装是我的主要目标。感谢您的帮助和支持!
答案 0 :(得分:1)
以下是在代码中设置InstanceName的示例:
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{4D044938-6185-4729-8EB9-33CFA5D51993}
AppName=My Program
AppVerName=My Program 1.5
AppPublisher=My Company, Inc.
AppPublisherURL=http://www.example.com/
AppSupportURL=http://www.example.com/
AppUpdatesURL=http://www.example.com/
DefaultDirName={pf}\My Program
DefaultGroupName=My Program
OutputBaseFilename = setup
Compression = lzma
SolidCompression = yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
Source: "SQLEXPR.exe"; DestDir: "{app}"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Run]
Filename: "{app}\SQLEXPR.exe" ; Parameters: "INSTANCENAME={code:MyInstanceName|'SQLEXPRESS'}";
[Code]
function MyInstanceName(Param: String): String;
begin
//This sets the value to \MSSQLSERVER.
Result := ExpandConstant('{computername}') + '\MSSQLSERVER';
end;
但是,根据我在网上看到的实例名称应该是MSSQLSERVER,如果你想让它成为机器上的默认实例。