public MetadataReference[] GetDefaultAssemblies() { var installation = dotNetInstallationLocator.GetReferenceAssemblyPath() ?? throw new InvalidOperationException("Could not find dotnet installation"); return(GroupDirectoryContentsIntoAssemblies( io.GetFilesInDirectory(installation.ImplementationPath, "*.dll", SearchOption.AllDirectories) .Union(io.GetFilesInDirectory(installation.DocumentationPath, "*.xml", SearchOption.AllDirectories)) ) .Where(assembly => assembly.AssemblyName.StartsWith("System")) .Select(assembly => io.CreateMetadataReferenceWithDocumentation(assembly)) .ToArray()); }
public async Task <LineEvaluationResult> HandleAsync(Guid lineId, string input, IReplLogger logger) { string assemblyFile = input.Substring(CommandPrefix.Length).Trim('"'); var assemblies = DotNetAssemblyLocator .GroupDirectoryContentsIntoAssemblies(ReadAssembly(assemblyFile)) .Select(assembly => io.CreateMetadataReferenceWithDocumentation(assembly)); foreach (var assembly in assemblies) { logger.LogOutput("Referencing " + assembly.Display); await scriptEvaluator.AddReferences(assembly); workspaceManager.CreateOrUpdateSubmission(lineId, assemblyReferences: assembly); logger.LogOutput("Assembly successfully referenced"); } return(LineEvaluationResult.NoOutput); }