We are using Sql Server database projects to create deployment scripts from DacPac using SqlPackage.exe. We have different SQL Server Filegroups setup in various environments. When deploying we exclude Filegroups as we want objects to create in the default Filegroup. In database project settings the default Filegroup is not changed from PRIMARY.
This presents a problem when attempting to deploy to an environment where the default Filegroup is not PRIMARY because the following code is included...
ALTER DATABASE [$(DatabaseName)]
MODIFY FILEGROUP [PRIMARY] DEFAULT;
Is there a way to prevent this from generating in the deployment SQL?
I don't know if you can disable it within SSDT.
But you can use deployment plan contributor to filter out MODIFY FILEGROUP statement or to change it the way you want. You can find detailed instructions and working code here: http://scardevblog.blogspot.com/2015/03/ssdt-generates-2012-option-for-target.html