Skip to content

Instantly share code, notes, and snippets.

@ax4413
Last active August 29, 2015 14:06
Show Gist options
  • Save ax4413/4e11a03bc7ca83c6cb3d to your computer and use it in GitHub Desktop.
Save ax4413/4e11a03bc7ca83c6cb3d to your computer and use it in GitHub Desktop.
MsBuild Helper
<!-- 1) Original command -->
<Exec Command="SQLCMD -S %22$(DBServerInstance)%22 -t -i %22$(SqlCmdScript)%22 -v Param1=%22Param1Value%22 Param2=%22Param2Value%22 Param3=%22Param3Value%22"/>
<!-- 2) Concat items in a property group with white spaces -->
<ItemGroup>
<Arg Include="-S %22$(192.168.0.1)%22" />
<Arg Include="-t" />
<Arg Include="-i %22$C:\Temp\Script.sql%22" />
<Arg Include="-v Param1=%22Param1Value%22 Param2=%22Param2Value%22 Param3=%22Param3Value%22" />
</ItemGroup>
<Exec Command="SQLCMD @(Arg, ' ') />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment