Example #1
0
        public static IEnumerable <string> ResolveRuntimeDependenciesCore(
            string entryPoint,
            string[] applicationDependencies,
            string[] monoBclDirectories)
        {
            var assembly = new AssemblyEntry(entryPoint, AssemblyDefinition.ReadAssembly(entryPoint));

            var dependencies = applicationDependencies
                               .Select(a => new AssemblyEntry(a, AssemblyDefinition.ReadAssembly(a)))
                               .ToArray();

            var bcl = monoBclDirectories
                      .SelectMany(d => Directory.EnumerateFiles(d, "*.dll").Select(f => Path.Combine(d, f)))
                      .Select(a => new AssemblyEntry(a, AssemblyDefinition.ReadAssembly(a)))
                      .ToArray();

            var assemblyResolutionContext = new AssemblyResolutionContext(
                assembly,
                dependencies,
                bcl);

            assemblyResolutionContext.ResolveAssemblies();

            var paths = assemblyResolutionContext.Results.Select(r => r.Path);

            return(paths.Concat(FindPdbs(paths)));
        }
Example #2
0
        public static void ResolveRuntimeDependencies(
            string entryPoint,
            string[] applicationDependencies,
            string[] monoBclDirectories,
            string[] resolutionOverrides,
            string outputFile)
        {
            var assembly = new AssemblyEntry(entryPoint, AssemblyDefinition.ReadAssembly(entryPoint));

            var dependencies = applicationDependencies
                               .Select(a => new AssemblyEntry(a, AssemblyDefinition.ReadAssembly(a)))
                               .ToArray();

            var bcl = monoBclDirectories
                      .SelectMany(d => Directory.EnumerateFiles(d, "*.dll").Select(f => Path.Combine(d, f)))
                      .Select(a => new AssemblyEntry(a, AssemblyDefinition.ReadAssembly(a)))
                      .ToArray();

            var assemblyResolutionContext = new AssemblyResolutionContext(
                assembly,
                dependencies,
                bcl);

            assemblyResolutionContext.ResolveAssemblies();

            var paths = assemblyResolutionContext.Results.Select(r => r.Path);

            File.WriteAllLines(outputFile, paths);
        }
Example #3
0
        public static IEnumerable <string> ResolveRuntimeDependenciesCore(
            string entryPoint,
            IEnumerable <string> applicationDependencies,
            IEnumerable <string> monoBclAssemblies)
        {
            var entryAssembly = new AssemblyEntry(entryPoint, GetAssemblyName(entryPoint));

            var dependencies = CreateAssemblyLookup(applicationDependencies);

            var bcl = CreateAssemblyLookup(monoBclAssemblies);

            var assemblyResolutionContext = new AssemblyResolutionContext(
                entryAssembly,
                dependencies,
                bcl);

            assemblyResolutionContext.ResolveAssemblies();

            var paths = assemblyResolutionContext.Results.Select(r => r.Path);

            return(paths.Concat(FindPdbs(paths)));