I am using SSDT (and sqlproj) for our MSSQL projects. We have a few variables we need to set when publishing to each environment.
This works great on most of our environments where we assign values to all of the variables, but when we publish to our live database, I would like to be able to make the DomainPrefix a blank string.
When I try to alter the Live.profile.xml to set DomainPrefix to no value I get the error: "An error occurred during deployment plan generation. Deployment cannot continue. Missing values for the following SqlCmd variables:DomainPrefix."
This what I would like the Live.profile.xml to look like:
<?xml version="1.0" encoding="UTF-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<TargetDatabaseName>DB_NAME</TargetDatabaseName>
<DeployScriptFileName>DB_NAME.sql</DeployScriptFileName>
<TargetConnectionString>CONNECTION_STRING</TargetConnectionString>
<ProfileVersionNumber>1</ProfileVersionNumber>
</PropertyGroup>
<ItemGroup>
<SqlCmdVariable Include="DomainPrefix">
<Value></Value>
</SqlCmdVariable>
<SqlCmdVariable Include="Environment">
<Value>live</Value>
</SqlCmdVariable>
</ItemGroup>
</Project>
Does anyone know how to set a SqlCmdVariable to a blank value or make it an optional variable?
Using:
- VS 2013 sqlproj
- SqlPackage.exe to run the publish to the DB from command line
:out
and shelling out via!!
not making the cut), and I do not believe all of those are available via SSDT publishing. I posted an answer below with the best I could come up with given the restrictions. – Distressful