Note that there are some explanatory texts on larger screens.

plurals
  1. POAdding existing project into new VS2012 solution programmatically fails
    primarykey
    data
    text
    <p>We have the following code in wizard to add existing project to a new solution:</p> <pre><code>//generating files if (dte.Solution.Projects.Count &lt; 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")); </code></pre> <p>It works just fine under MS Visual Studio 2010, but fails under 2012 (I experimented with second parameter):</p> <blockquote> <p>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()</p> </blockquote> <p>After this error I'm adding the new project to the solution manually and everything works OK. But we can not just say, "Sorry, we can not add newly generated project for you so please add it by yourself."</p> <p>MSDN proposes:</p> <blockquote> <p>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.</p> </blockquote> <p>But this method requires some wizard file, so it can not be a solution.</p> <p>Could someone help? Wizard is running from "New -> Project" menu.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload