Executing Custom Sql Script using BTDF

Topics: Bindings File, Settings Management and SSO, Server Deployment
Jul 3, 2013 at 8:54 AM
Edited Jul 3, 2013 at 8:55 AM
Hi,
I am using Biztalk 2013 and BTDF 5_1 Beta2. I want to execute a sql script where I pass the server name and filename as parameter from SettingsFileGenerator file.I have used AdditionalFiles tag to copy my sql script.
I have used this
<Exec Command="sqlcmd.exe -S $(SQLScriptDataBase) -i ..\$(SQLScriptFileName)" .
When I place this in CustomRedist , I am not able to create a MSI and it fails with error:
error MSB3073: The command "sqlcmd.exe -S -i ..\" exited with code 1 . May be it is not able to set the variables when I place it in CustomRedist. But it works fine when i try to deploy from VisualStudio using BTDF.

When I remove it from CustomRedist and put it in any other custom target , I am able to create a MSI but it fails when I try to deploy using Visual Studio BTDF deploy as it is not able to find the Sqlfile.
Is there a way where I can achieve both of this .

With Regards,
Nikhil Rai
Coordinator
Jul 8, 2013 at 6:14 AM
Hi Nikhil,

Putting the command in the other custom target that you created was the correct approach. All relative paths are based on the folder that contains the .btdfproj. If you use AdditionalFiles, which only affects the MSI generation and thus server deploys, the files will all end up one level above the .btdfproj folder. If that is the same location where you currently have the SQL files then you can use the same relative path for server and Visual Studio deployments. If you keep the SQL files in a different folder, then it's best not to use AdditionalFiles and just copy the files to the same directory structure inside the CustomRedist target (the Advanced sample app contains a copy step like that). That way the path is the same whether Visual Studio or MSI deploy.

In addition to that, I think you need to add SQLScriptDataBase and SQLScriptFileName to the PropsFromEnvSettings ItemGroup, because it appears that they are not being carried over from your settings spreadsheet.

Thanks,
Tom
Jul 10, 2013 at 9:37 AM
Hi tfaabraham,
I tried it without using additionalfiles element and it works now.
Thanks for your help.

\Nikhil Rai