I've got a Web API 2 project set up using Code First. The publish dialog was detecting the DB and allowing me to use Code First Migrations.
I then added a second DB connection using the steps here.
Now when I publish, the dialog only detects the new database and does not give me any options for the original one.
I removed every reference to the second DB that I can find, but the Publish dialog is still showing references to it (and not to the original DB). I've compared my current revision to the one before I added the second DB, and the pubxml for my publishing profile is different, but VS auto-generates the part that is different:
Before:
<PublishDatabaseSettings>
<Objects>
<ObjectGroup Name="DefaultConnection" Order="1" Enabled="True">
<Destination Path="" />
<Object Type="DbCodeFirst">
<Source Path="DBMigration" DbContext="Project.Models.ApplicationDbContext, Project" MigrationConfiguration="Project.Migrations.Configuration, Project" Origin="Convention" />
</Object>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
...
<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)DefaultConnection-Web.config Connection String">
<ParameterValue>Data Source=localhost;Initial Catalog=OriginalDB;User ID=user;Password=password</ParameterValue>
</MSDeployParameterValue>
</ItemGroup>
<ItemGroup>
<_ConnectionStringsToInsert Include="DefaultConnection" />
</ItemGroup>
After:
<PublishDatabaseSettings>
<Objects>
<ObjectGroup Name="NewDatabase" Order="2" Enabled="False" xmlns="">
<Destination Path="" />
<Object Type="DbDacFx">
<PreSource Path="Data Source=(localdb)\MSSQLLocalDB;Initial Catalog=newcatalog;Integrated Security=True;Application Name=EntityFramework" includeData="False" />
<Source Path="$(IntermediateOutputPath)AutoScripts\NewDatabase_IncrementalSchemaOnly.dacpac" dacpacAction="Deploy" />
</Object>
<UpdateFrom Type="Web.Config">
<Source MatchValue="data source=(localdb)\MSSQLLocalDB;initial catalog=newcatalog;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" MatchAttributes="$(UpdateFromConnectionStringAttributes)" />
</UpdateFrom>
</ObjectGroup>
</Objects>
</PublishDatabaseSettings>
...
<ItemGroup>
<MSDeployParameterValue Include="$(DeployParameterPrefix)NewDatabase-Web.config Connection String" />
</ItemGroup>
I'm not sure where this is being generated from, how would I go about getting this to work with both databases, or failing that, getting it back to the point where it works with the original DB?