문제

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.

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top