Я написал собственный установочный скрипт для изменения строки подключения.
Фрагмент кода:
function Update_AppConfig(hMSI)
STRING EXAMPLE_FILE, EXAMPLE_DIR;
STRING svLine;
STRING svContent;
number nvBuff,temp,nvFileHandle ;
string szConnection,szServer,szFileName,szUser,szFilePath;
long cchValueBuf;
long length;
begin
EXAMPLE_FILE = "Example.exe.config";
EXAMPLE_DIR = INSTALLDIR;
cchValueBuf = 2;
MsiGetProperty(hMSI,"IS_SQLSERVER_SERVER",szServer,cchValueBuf);
OpenFileMode (FILE_MODE_NORMAL);
if (OpenFile (nvFileHandle, EXAMPLE_DIR, EXAMPLE_FILE) < 0) then
MessageBox ("OpenFile failed.", SEVERE);
abort;
endif;
while GetLine (nvFileHandle, svLine) = 0
svContent = svContent + svLine + "\r\n";
endwhile;
if (CloseFile (nvFileHandle) < 0) then
MessageBox ("CloseFile failed.", SEVERE);
endif;
StrReplace (svContent, "{{SQLSERVERSETTING}}", szServer, 0);
// Close the file.
OpenFileMode (FILE_MODE_BINARY);
if (OpenFile (nvFileHandle, EXAMPLE_DIR, EXAMPLE_FILE) < 0) then
MessageBox ("OpenFile failed.", SEVERE);
abort;
endif;
length = StrLength (svContent);
if (WriteBytes (nvFileHandle, svContent, 0, length) < 0) then
MessageBox ("WriteBytes failed.", SEVERE);
endif;
if (CloseFile (nvFileHandle) < 0) then
MessageBox ("CloseFile failed.", SEVERE);
endif;
end;