Ejemplo n.º 1
0
        private ILibraryExport ExportPackageLibrary(Library library)
        {
            // Get the lock file group and library
            var group = library.GetRequiredItem<LockFileFrameworkGroup>(KnownLibraryProperties.LockFileFrameworkGroup);
            var lockFileLibrary = library.GetRequiredItem<LockFileLibrary>(KnownLibraryProperties.LockFileLibrary);

            // Resolve the package root
            var packageRoot = _packagePathResolver.ResolvePackagePath(
                lockFileLibrary.Sha,
                lockFileLibrary.Name,
                lockFileLibrary.Version);

            // Grab the compile time assemblies and their full paths
            var metadataReferences = new List<IMetadataReference>();
            foreach (var compileTimeAssembly in group.CompileTimeAssemblies)
            {
                var reference = new MetadataFileReference(
                    Path.GetFileNameWithoutExtension(compileTimeAssembly),
                    Path.Combine(packageRoot, compileTimeAssembly));

                metadataReferences.Add(reference);
            }

            return new LibraryExport(metadataReferences);
        }