43

I've been using Visual Studio 2012 RC with trial license with no problems. I purchased Visual Studio 2012 Professional yesterday, installed the latest version, and installed Update 1.

I have a solution/project I've been working on for many years. It has many migrations in it. I ran my first add-migration TableX_NewField and update-database -sourcemigration:TableX_PreviousNewField in this latest version.

They both ran with no problems.

Then I ran update-database -script -sourcemigration:TableX_PreviousNewField and received the following:

PM> update-database -script -sourcemigration:TableX_PreviousNewField
Applying code-based migrations: [201301151003149_TableX_NewField].
Applying code-based migration: 201301151003149_TableX_NewField.
System.Runtime.InteropServices.COMException (0x8004000C): User canceled out of save dialog (Exception from HRESULT: 0x8004000C (OLE_E_PROMPTSAVECANCELLED))
  at EnvDTE.ItemOperations.OpenFile(String FileName, String ViewKind)
  at System.Data.Entity.Migrations.Utilities.DomainDispatcher.OpenFile(String fileName)
  at System.Data.Entity.Migrations.Utilities.DomainDispatcher.OpenFile(String fileName)
  at System.Data.Entity.Migrations.Extensions.ProjectExtensions.NewSqlFile(Project project, String contents)
  at System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
  at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
User canceled out of save dialog (Exception from HRESULT: 0x8004000C (OLE_E_PROMPTSAVECANCELLED))

I've ran windows updates. Checked updates with NuGet. Restarted my computer. Still have error.

7
  • Do you have any additional Visual Studio extensions installed besides NuGet? Commented Jan 15, 2013 at 17:52
  • Also, have you tried repairing Visual Studio? Commented Jan 15, 2013 at 17:53
  • 6
    You could try installing the SQL Server Data Tools. This should allow it to open in a SQL editor instead of using ItemOperations.OpenFile(). Commented Jan 16, 2013 at 17:21
  • 6
    I have installed the latest SQL Server Data Tools (msdn.microsoft.com/en-us/data/hh297027) and that seems to have resolved the issue. Commented Jan 25, 2013 at 17:08
  • 12
    I highly disagree with the closing decision. This question is VERY likely to help a lot of future visitors. Commented Mar 1, 2013 at 22:09

2 Answers 2

65

I noticed in visual studio, going to SQL menu, Transact-SQL Editor, New Query... gave a dialog about the tools not working with the server installed. Installing SQL Server Data Tools - December 2012 update (Sql Server Data Tools) fixed the problem

Sign up to request clarification or add additional context in comments.

5 Comments

was skeptical but worked for me - was using command Update-Database -Script -SourceMigration:0 which gets full SQL from scratch
you do need to restart Visual studio after installing the tools
Using Web Platform Installer do a search for Data Tools and install the Microsoft SQL Server Data Tools for Visual Studio 2012, Released 12/10/2012.
I just experienced the same error with Visual Studio 2012 Update 2 and EF 4.3. This had been working fine but two possible changes on my machine that may have broken it were an update to Nuget package manager 2.6.40627.9000 and a failed VS2012.3 update that was rolled back. Applying SQL Server Data Tools - June 2013 update fixed it for me.
As Simon_Weaver said, you have to restart Visual Studio. If you don't restart VS, the SQL > Transact SQL > New Query menu will STOP showing the original error, but the Package Manager Console will continue throwing errors. Restart the whole thing!
4

This issue is resolved. I uninstalled and then installed and the problem was not resolved. I then did two things at the same time; so I do not know which resolved the issue:

  1. Deleted all folders and files in %temp%.
  2. Ran devenv /resetsettings.

Hope this helps anyone who runs into a similar issue.

1 Comment

Did same thing, said skip to deleting files that required admin or was in use. And it worked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.