File tree 2 files changed +21
-3
lines changed
2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -551,9 +551,26 @@ module SolutionExplorer =
551
551
let! name = window.showInputBox( opts)
552
552
if JS.isDefined dir && JS.isDefined name then
553
553
let output = if String.IsNullOrWhiteSpace dir then None else Some dir
554
- let name = if String.IsNullOrWhiteSpace name then None else Some name
554
+ let projName = if String.IsNullOrWhiteSpace name then None else Some name
555
+
556
+ let! _ = LanguageService.dotnetNewRun template.description projName output
557
+ let model = getSolution()
558
+ //If it's the solution workspace we want to add project to the solution
559
+ match model with
560
+ | Some ( Workspace [ Solution (_,_, slnName, _)]) ->
561
+ let pname =
562
+ if projName.IsSome then projName.Value + " .fsproj" else
563
+ if output.IsSome then output.Value + " .fsproj" else
564
+ ( path.dirname workspace.rootPath) + " .fsproj"
565
+
566
+ let proj =
567
+ path.join( workspace.rootPath, dir, name, pname)
568
+ Project.execWithDotnet MSBuild.outputChannel ( sprintf " sln %s add %s " slnName proj) |> ignore
569
+ | _ ->
570
+ //If it's the first project in the workspace we need to init the workspace
571
+ if Project.getInWorkspace() .IsEmpty then
572
+ do ! Project.initWorkspace()
555
573
556
- let! _ = LanguageService.dotnetNewRun template.description name output
557
574
()
558
575
else
559
576
window.showErrorMessage " No open folder." |> ignore
Original file line number Diff line number Diff line change @@ -602,7 +602,8 @@ module Project =
602
602
|> Array.map fst
603
603
604
604
match x with
605
- | WorkspacePeekFound.Solution _
605
+ | WorkspacePeekFound.Solution _ ->
606
+ setAnyProjectContext true
606
607
| WorkspacePeekFound.Directory _ when not ( projs |> Array.isEmpty) ->
607
608
setAnyProjectContext true
608
609
| _ -> ()
You can’t perform that action at this time.
0 commit comments