0

I have an F# program that creates an instance of Visual Studio:

  let vsTy = Type.GetTypeFromProgID("VisualStudio.DTE.10.0") in
  let dte2 = Activator.CreateInstance(vsTy,true) :?> EnvDTE80.DTE2 in
  ...

That works well; I can probe all kinds of info about the running instance of Visual Studio.

But I can't determine how to load a solution into the instance of Visual Studio. I've tried dte2.ItemOperations.OpenFile(). I've also tried dte2.ExecuteCommand("File.OpenProject"), which works, but requires the user to select from a file dialog -- I want something that works from code alone.

1 Answer 1

0

Here's how to do it: let soln2 = dte2.Solution :?> EnvDTE80.Solution2 in let _ = soln2.Open(solutionFile) in ... Bizarre, because dte2.Solution isn't a solution at all.

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.