private MSBuildWorkspace( HostServices hostServices, ImmutableDictionary <string, string> properties) : base(hostServices, "MSBuildWorkspace") { _loader = new MSBuildProjectLoader(this, properties); }
private MSBuildWorkspace( HostServices hostServices, ImmutableDictionary<string, string> properties) : base(hostServices, "MSBuildWorkspace") { _loader = new MSBuildProjectLoader(this, properties); }
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); }
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); } }