MSBuild.Sdk.SqlProj
MSBuild.Sdk.SqlProj copied to clipboard
Feature request: Allow for specifying multiple SqlServerVersions on single project
The .NET SDK csproj standard allows for specifying a multi-value TargetFrameworks property as an alternative to the single-value TargetFramework property, e.g.:
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
</PropertyGroup>
With the above, building the project would produce DLLs for all three frameworks specified.
In the same vein, this sqlproj SDK standard should ideally allow for specifying a multi-value SqlServerVersions property as an alternative to the single-value SqlServerVersion property, e.g.:
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<SqlServerVersions>Sql130;SqlAzure</SqlServerVersions>
</PropertyGroup>
The above addition should allow for building the same sqlproj project against multiple SQL Server versions with one build command, which would as a result allow for deploying the same database schema to both an on-premise database and an Azure SQL database (as in the example above) without having to maintain two separate projects that are identical in every regard except for the SqlServerVersion.
Thank you for your suggestions @sykesjd. I think this would be a great addition and I can see the value in it. If anyone is willing to implement this we would gladly take a PR for it. Not sure when I'll get around to implementing this myself.
@sykesjd I have no issues with deployment to my localDb when SqlServerVersion is SqlAzure.
@sykesjd I have no issues with deployment to my localDb when SqlServerVersion is SqlAzure.
No, but you can't deploy a dacpac targeting SqlAzure to an on-premise SQL Server instance - one of the teams where I work found that out the hard way.
LocalDB is an "on-premise SQL Server instance" - which SQL version were being deployed to?
LocalDB is an "on-premise SQL Server instance" - which SQL version were being deployed to?
If memory serves, it was a SQL Server 2016 instance.
To clarify, the scenario I mentioned dealt with an actual sqlproj project rather than one of these SDK projects.
You can just use the /p:AllowIncompatiblePlatform=true option when publishing @jmezach FYI