Having been busy packing the installer recently, using InstallShield 15, the packaging process encountered a small problem (suspected to be InstallShield 15 bug), but it took me a night to solve the problem.
When you use InstallShield to create an installer to build a asp.net web site, you need to make some changes to the property values in Web.config, such as connection String, which you need to change to:
Data Source=[is_sqlserver_server];D atabase=[is_sqlserver_database];uid=[is_sqlserver_username];p wd=[is_ Sqlserver_password]
Where Is_sqlserver_server, Is_sqlserver_database, Is_sqlserver_username, Is_sqlserver_password are the property values entered by the user during installation. In order to achieve Web.config changes, you can use the XML Files in InstallShield Changes, but I found a problem, according to the database default, the user name is SA, the password is empty, if the above mentioned connection String directly into the value of the attribute is connectionstring, because the Is_sqlserver_password is null, the final installation result, In the web.config is: connectionstring= "", all become empty? But if you don't add "Pwd=[is_sqlserver_password", everything is fine, that is, because the property is empty, it causes the entire value to become empty. I suspect a bug in InstallShield 15.
The final solution is as follows:
First step:
Create a new Property:[connection_string in Property manager and add Web.config to the XML Files changes in configuration-> connectionstrings-> add[@connectionString = "Data source=;D atabase=;uid=sa;pwd=" and @name = "Dbstr"], add an item, Attribute:connectionstring,value for just created property:[connection_string]
Step Two:
To add a script to the InstallScript:
function ChangeProperty(hMSI)
STRING svConStr,svServer,svDBName,svUID,svPWD;
NUMBER nRet;
begin
nRet=128;
MsiGetProperty(hMSI,"IS_SQLSERVER_SERVER",svServer,nRet);
MsiGetProperty(hMSI,"IS_SQLSERVER_DATABASE",svDBName,nRet);
MsiGetProperty(hMSI,"IS_SQLSERVER_USERNAME",svUID,nRet);
MsiGetProperty(hMSI,"IS_SQLSERVER_PASSWORD",svPWD,nRet);
svConStr="Data Source="+svServer+";DataBase="+svDBName+";uid="+svUID+";pwd="+svPWD;
MsiSetProperty(hMSI,"CONNECTION_STRING",svConStr);
end;
Step Three:
Add a new action in the custom Actions and sequences, for example, called Setconnetionstring,function name ChangeProperty, and set its execution order to after Installinitialize.
The end is done! After the experiment, the result connectionString the value is expected, such as: connectionstring= "Data source=sqlserver;database=db;uid=sa;pwd="