Why do you think it is searching for the file in the SQL Server bin folder where sqlcmd.exe resides?
Is your folder structure:
Is your folder structure:
\My.sln
\Deployment
My.btdfproj
\DBScripts
SQLQuery.sql
If so, when you use AdditionalFiles to package the file into the MSI, its location will move UP one level from DBScripts. If you want to preserve the same structure with a DBScripts subfolder, then you need to copy the file to the redist (obj\Debug\redist) folder yourself and remove the file(s) from AdditionalFiles. Then your command line above with ..\DBScripts should point to the correct location after installing the MSI.<Target Name="CustomRedist">
<MakeDir Directories="$(RedistDir)\DBScripts" />
<!-- Force MSBuild to expand the item spec into physical file specs -->
<CreateItem Include="..\DBScripts\**\*.*">
<Output TaskParameter="Include" ItemName="SQLFilesSourceGroup" />
</CreateItem>
<Copy DestinationFolder="$(RedistDir)\DBScripts\%(RecursiveDir)" SourceFiles="@(SQLFilesSourceGroup)"/>
</Target>
Tom