Home Dashboard Directory Help

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


 as Won't Fix Help for as Won't Fix

Sign in
to vote
Type: Bug
ID: 755456
Opened: 7/25/2012 6:09:10 AM
Access Restriction: Public
User(s) can reproduce this bug


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(http://support.microsoft.com)
Sign in to post a workaround.
Posted by Taras Kozubskij on 7/26/2012 at 3:54 AM
Before adding the project to solution, project file should be converted to VS2012 format.