Releases: rr-wfm/MSBuild.Sdk.SqlProj
Support for large projects
For some larger projects users could run into an issue, especially on Windows, where the command line tool being run by the SDK to perform the actual packaging would fail because the command line arguments list would be too long. This has now been resolved by writing the list of files that are included in the project to a text file, which is then picked up by the command line tool.
Thanks to @jeffrosenberg for this contribution.
External databases and .NET 5.0 support
This releases adds support for using a PackageReference
as an external database. This is useful if you want to make use of database objects that are defined in another database, for example the master
database. This is achieved by adding the DatabaseVariableLiteralValue
item metadata to the package reference and setting it to the name of the external database. You can then use objects from the referenced .dacpac
using the [<database-variable-literal-value>].[<schema>].[<object>]
syntax within your project.
Additionally we now support building projects leveraging MSBuild.Sdk.SqlProj
with the .NET 5.0 preview SDK's. Previously if you had the preview SDK installed you would encounter the error message The current SDK bundles target framework 'netcoreapp5.0)' which is not supported by MSBuild.Sdk.SqlProj. Either install a .NET Core SDK that supports 2.1 or 3.1, or file an issue at https://github.com/jmezach/MSBuild.Sdk.SqlProj/ to add support.
. This could be resolved by adding a global.json
pinning your SDK version to either 2.1 or 3.1. Now the error should no longer appear if you have the 5.0 preview SDK installed.
Bugfix
RefactorLog support
The original SQL Server Database Projects maintain a log of refactorings performed in the database project. These are stored in a .refactorlog
file. In previous versions of MSBuild.Sdk.SqlProj these weren't embedded in the resulting .dacpac
. Now we embed this file into the package if it is defined in the .csproj
using the following syntax:
<Project Sdk="MSBuild.Sdk.SqlProj/1.5.0">
...
<ItemGroup>
<RefactorLog Include="TestProject.refactorlog" />
</ItemGroup>
...
</Project>
Template pack
Starting with 1.4.0 we are now also shipping a set of templates that can be used with dotnet new
. These ship as a separate NuGet package that can be installed using dotnet new --install MSBuild.Sdk.SqlProj.Templates
. After that you can create new projects using dotnet new sqlproj
. We've also included item templates for some of the most common SQL object types such as Tables, Views, Stored Procedures and Functions. If you feel a particular object type is missing please don't hesitate to file an issue or submit a PR. Eventually these templates will also start showing up in Visual Studio. This feature is currently in preview and we've already identified an issue that the Visual Studio team will be looking into.
Note that the version of the templates is updated in lock-step with the main package itself, meaning that when a new version of MSBuild.Sdk.SqlProj
ships a new version of MSBuild.Sdk.SqlProj.Templates
is also shipping and the template will reference the new version of MSBuild.Sdk.SqlProj
. You can update your installed version of the templates using dotnet new --update-apply
. Although we've also shipped a new version of MSBuild.Sdk.SqlProj
with this release no changes have been made to its functionality. We've merely added the templates.
Floating versions and incremental build support
Version 1.3.0 introduces support for floating versions for PackageReference
s allowing you to specify a version like1.3.*
for a package reference and it will resolve to the latest 1.3 version of the specified package available. Thanks to @jeffrosenberg for his contribution on this.
This version also adds incremental build support meaning which should speed up repeated builds. As long as the source files (*.sql
) and the project file (.csproj
) have the same or an older last modified date as the .dacpac
the .dacpac
will not be build again. This saves the time needed to rebuild the package. Thanks to @jvilimek for his contribution.
Adding publishing support
MSBuild.Sdk.SqlProj 1.2.0 introduces support for publishing a project to a local SQL Server instance. On Windows running dotnet publish
should work out-of-the-box if you have a default SQL Server instance installed on your machine. On Mac and Linux we cannot use Windows authentication, so you'll need to specify a username and password. Checkout the README for more details on how publishing works and how you can customize the process to suit your needs.
IMPORTANT: With this release we've dropped support for .NET Core 2.2 since that version is end-of-life. You should upgrade your projects to .NET Core 3.1.
Fix cross-platform issues
Two issues have been resolved that could be observed when using MSBuild.Sdk.SqlProj on Mac and/or Linux.
SqlCmd variables and pre/post-deployment script support
This release added support for SqlCmd variables as well as pre- and postdeployment scripts to be included with the .dacpac
.
Added LICENSE
Added a LICENSE to the NuGet package