Adding existing project into new VS2012 solution through _Solution.AddFromFile fails - by Taras Kozubskij

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 755456 Comments
Status Closed Workarounds
Type Bug Repros 2
Opened 7/25/2012 6:09:10 AM
Access Restriction Public


Wizard is running from "New -> Project" menu.
We have the following code in the wizard to add existing project to a new solution:

//generating files
if (dte.Solution.Projects.Count < 1) // Solution is empty or doesn't exist
    dte.Solution.Create(oneFolderHigher(Params.OutputDir, solutionName), solutionFileName(solutionName));

// adding created project to solution
dte.Solution.AddFromFile(Path.Combine(Params.ProjectRootFolder, Params.ProjectName + ".csproj"));

It works just fine under MS Visual Studio 2010, but fails under 2012 (I experimented with second parameter):

System.Runtime.InteropServices.COMException (0x80004004): Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))
at EnvDTE.SolutionClass.AddFromFile(String FileName, Boolean Exclusive)
at Wizard.Generator.NewProjectGenerator.Generate(Action`1 logMessage)
at Wizard.Forms.WizardForm.Finish()

After this error I'm adding the new project to the solution manually and everything works OK.

MSDN proposes:

You can use the LaunchWizard method rather than AddFromFile to execute a wizard if you want to suppress its UI during execution. LaunchWizard has a parameter that allows you to disable the UI.

But this method requires some wizard file, so it can not be a solution.
Sign in to post a comment.
Posted by Microsoft on 7/31/2012 at 5:09 PM
Thanks for your feedback. Please use the workaround as we will be unable to incorporate this suggestion in the next VS release.
Posted by Microsoft on 7/26/2012 at 1:37 AM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 7/25/2012 at 6:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(