Exemplo n.º 1
0
 private MSBuildWorkspace(
     HostServices hostServices,
     ImmutableDictionary <string, string> properties)
     : base(hostServices, "MSBuildWorkspace")
 {
     _loader = new MSBuildProjectLoader(this, properties);
 }
Exemplo n.º 2
0
 private MSBuildWorkspace(
     HostServices hostServices,
     ImmutableDictionary<string, string> properties)
     : base(hostServices, "MSBuildWorkspace")
 {
     _loader = new MSBuildProjectLoader(this, properties);
 }
Exemplo n.º 3
0
 private MSBuildWorkspace(
     HostServices hostServices,
     ImmutableDictionary <string, string> properties)
     : base(hostServices, WorkspaceKind.MSBuild)
 {
     _reporter = new DiagnosticReporter(this);
     _projectFileLoaderRegistry = new ProjectFileLoaderRegistry(Services, _reporter);
     _loader = new MSBuildProjectLoader(Services, _reporter, _projectFileLoaderRegistry, properties);
 }
Exemplo n.º 4
0
        public void TestLoadTextSync()
        {
            var files = GetAnalyzerReferenceSolutionFiles();

            CreateFiles(files);

            using (var ws = new AdhocWorkspace(DesktopMefHostServices.DefaultServices))
            {
                var projectFullPath = Path.Combine(this.SolutionDirectory.Path, @"AnalyzerSolution\CSharpProject_AnalyzerReference.csproj");

                var loader = new MSBuildProjectLoader(ws);
                var infos = loader.LoadProjectInfoAsync(projectFullPath).Result;

                var doc = infos[0].Documents[0];
                var tav = doc.TextLoader.LoadTextAndVersionSynchronously(ws, doc.Id, CancellationToken.None);

                var adoc = infos[0].AdditionalDocuments.First(a => a.Name == "XamlFile.xaml");
                var atav = adoc.TextLoader.LoadTextAndVersionSynchronously(ws, adoc.Id, CancellationToken.None);
                Assert.Contains("Window", atav.Text.ToString(), StringComparison.Ordinal);
            }
        }