1+ (* Fix paths for release *)
2+ #r @" bin\Debug\MessageFilterImpl.dll"
3+ #r @" bin\Debug\Sln2NMake.VisualStudioAutomation.Interfaces.dll"
4+ #r @" System.ComponentModel.Composition.dll"
5+ #r @" bin\Debug\ImpromptuInterface.dll"
6+ #r @" bin\Debug\ImpromptuInterface.FSharp.dll"
7+
8+
9+ //namespace Sln2NMake
10+
11+ open MessageFilterImpl ;
12+ open System.ComponentModel .Composition
13+ open System.ComponentModel .Composition .Hosting
14+ open System.Collections .Generic
15+ open Sln2NMake.VisualStudioAutomation .Interfaces
16+ open System.Diagnostics ;
17+ open System.Reflection ;
18+ open ImpromptuInterface
19+ open ImpromptuInterface.FSharp
20+
21+ (* Creating a new type to import the plugins for Visual Studio *)
22+
23+ type AutomationPlugins () =
24+ class
25+ (* The container that will hold all the composed parts *)
26+ [<DefaultValue( true ) >]
27+ val mutable private _container : CompositionContainer
28+
29+ (* Change the metadata to access more strongly type metadata *)
30+ let mutable _DTEFactories : IEnumerable < System.Lazy < IDTEFactory , IDictionary < string , System.Object > > > = null
31+
32+ [<ImportMany>]
33+ member public this.DTEFactories
34+ with get() = _ DTEFactories
35+ and set ( value ) = _ DTEFactories <- value
36+
37+ member public this.Compose () =
38+ (* Check if directory exists *)
39+ let mutable catalog = new AggregateCatalog()
40+
41+ Assembly.Load( @" bin\Debug\Sln2NMake.VisualStudio2010Automation" )
42+ |> fun assembly -> new AssemblyCatalog( assembly)
43+ |> catalog.Catalogs.Add
44+ this._ container <- new CompositionContainer( catalog)
45+ this._ container.ComposeParts( this)
46+ end
47+
48+ (* Register the Message Filter *)
49+
50+ module AutomationTests =
51+ MessageFilter.Register()
52+ let automationPlugins = new AutomationPlugins()
53+ automationPlugins.Compose()
54+ let dteFactory = automationPlugins.DTEFactories |> Seq.head |> fun lv -> lv.Value
55+ let dte = dteFactory.CreateDTE()
56+
57+ let solution = dte.Solution
58+ solution.Open( @" c:\views\isiteclient\trunk\isiteclient\products\src\isiteclient.sln" )
59+ let solutionProjects = solution.Projects
60+ let uiLibraryProjectItems = solutionProjects
61+ |> Seq.toList
62+ |> fun pl -> pl.[ 3 ]. ProjectItems
63+ |> Seq.toList
64+ let vcppProject3 = uiLibraryProjectItems.[ 0 ]. SubProject :?> IVCppProject
65+ printf " %s %s " vcppProject3.Name vcppProject3.Kind
66+ printf " Using Dynamic Look up for Project 3 %s " vcppProject3.Object?Name
67+ let vcppProject3Configs = vcppProject3.Files |> Seq.nth 10 |> fun f -> f.FileConfigurations
68+
69+ (*
70+ vcppProject3.Files |> Seq.nth 10|> fun f -> f.FileConfigurations |> Seq.nth 0 |> (fun cfg -> cfg.CustomBuildRule);;
71+ *)
0 commit comments