I just updated my existing SQL Server 2008 r2.dbproj for SQL Server 2012.sqlproj (using SQL Server data tools).
I used to be able to define the SQLCMD variable in my project, and then determine the value by editing the project file to use the msbuild values, adding the following element:
<ItemGroup> <SqlCommandVariableOverride Include="ProjectDirectory=$(MSBuildProjectDirectory)" /> </ItemGroup>
What I could use in my PostDeployment script as follows:
SELECT * INTO dbo.MyTable FROM dbo.MyTable WHERE 1=2 BULK INSERT dbo.MyTable FROM '$(ProjectDirectory)\data\dbo.MyTable.dat' WITH (DATAFILETYPE = 'widenative')
However, after the upgrade, this no longer works.
I tried adding the same entry to the new sqlproj, but the Publish function does not seem to pick it up and does not want me to give a value. If I put $(MSBuildProjectDirectory) , this is interpreted literally and fails.
In the new mode, what is the mechanism for specifying the local file path and / or using msbuild values?
Kent McNeill
source share