Ejemplo n.º 1
0
        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());
        }
Ejemplo n.º 2
0
        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);
        }