Dacpac deployment via sqlpackage, “DropObjectsNotInSource=True” is trying to drop .mdf & .ldf Powershell deployment script:

Executing: C:\Program Files (x86)\Microsoft SQL Server\110\DAC\bin\sqlpackage.exe /Action:Publish /SourceFile:********.dacpac /Profile:Release.Publish.xml /TargetConnectionString:server=********;database=********;uid==********;pwd=********;app=********;timeout=900 /p:IgnoreAuthorizer=True /p:IgnorePermissions=True /p:IgnoreRoleMembership=True /p:IgnoreUserSettingsObjects=True /p:BlockOnPossibleDataLoss=False /p:TreatVerificationErrorsAsWarnings=True /p:GenerateSmartDefaults=True 
Error *** The object [********] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box. 
Error *** The object [********_log] exists in the target, but it will not be dropped even though you selected the 'Generate drop statements for objects that are in the target database but that are not in the source' check box. 
Info Initializing deployment (Complete) 
Info Analyzing deployment plan (Start) 
Info Analyzing deployment plan (Complete) 
Info Updating database (Start) 
Info Starting ********.sql 
Info Update complete. 
Info Updating database (Complete) 
Info Successfully published database.


Release.Publish.xml:

&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"&gt;
  &lt;PropertyGroup&gt;
    &lt;CreateNewDatabase&gt;False&lt;/CreateNewDatabase&gt;
    &lt;BackupDatabaseBeforeChanges&gt;False&lt;/BackupDatabaseBeforeChanges&gt;
    &lt;BlockOnPossibleDataLoss&gt;True&lt;/BlockOnPossibleDataLoss&gt;
    &lt;NoAlterStatementsToChangeCLRTypes&gt;False&lt;/NoAlterStatementsToChangeCLRTypes&gt;
    &lt;DropObjectsNotInSource&gt;True&lt;/DropObjectsNotInSource&gt;
    &lt;DeployDatabaseInSingleUserMode&gt;False&lt;/DeployDatabaseInSingleUserMode&gt;
    &lt;DeployScriptFileName&gt;Release.sql&lt;/DeployScriptFileName&gt;
    &lt;ProfileVersionNumber&gt;1&lt;/ProfileVersionNumber&gt;
    &lt;UnmodifiableObjectWarnings&gt;False&lt;/UnmodifiableObjectWarnings&gt;
  &lt;/PropertyGroup&gt;
&lt;/Project&gt;


Why is this trying to drop mdf and ldfs?

From Project-Oriented Database Development using Command-Line Tools: I can tell the fix would possibly be to use DoNotDropObjectType to make DropObjectsNotInSource behave more responsibly, if so how?

Honestly I'm confused why this is even an issue in the first place.
If your mdf and ldf files are in a non-default location (or have a non-default prefix / name), you need to add that information to the SSDT project.  This will help the schema compare operation (that occurs when you do a publish) to see that the files are in the right place and don't need to be dropped / recreated.

Right-click your project -> Add New Item -> File Group File

You'll get something like this:

/*
Do not change the database path or name variables.
Any sqlcmd variables will be properly substituted during 
build and deployment.
*/
ALTER DATABASE [$(DatabaseName)]
    ADD FILE
    (
        NAME = [SqlFile1],
        FILENAME = '$(DefaultDataPath)$(DefaultFilePrefix)_SqlFile1.ndf'
    )


Modify that script so that it points to the desired location of your primary data file (mdf) and your deploy should go much more smoothly.

Note that $(DefaultDataPath) is set by the settings of the target instance:



And $(DefaultFilePrefix) is set by the "TargetDatabaseName" in your publish.xml file.