private void InstallCompositionPackagesIfNeeded( IComponentModel services, IVsPackageInstallerServices nuget, Lazy<XElement> wizardData )
        {
            Contract.Requires( services != null );
            Contract.Requires( nuget != null );
            Contract.Requires( wizardData != null );

            // ensure composition is enabled
            if ( !GetBoolean( "$compose$" ) )
                return;

            var packages = wizardData.Value;
            var packageIds = new[] { "Microsoft.Composition", "More.Composition" };
            var packageVersions = new Dictionary<string, string>();

            // build collection of required packages and versions
            foreach ( var packageId in packageIds )
            {
                if ( nuget.IsPackageInstalled( Project, packageId ) )
                    continue;

                var packageVersion = ( from element in packages.Elements( "package" )
                                       let id = (string) element.Attribute( "id" )
                                       where id == packageId
                                       select (string) element.Attribute( "version" ) ).FirstOrDefault();

                if ( !string.IsNullOrEmpty( packageVersion ) )
                    packageVersions[packageId] = packageVersion;
            }

            InstallPackages( services, packages, packageVersions );
        }
        private void InstallEntityFrameworkPackageIfNeeded( IComponentModel services, IVsPackageInstallerServices nuget, Lazy<XElement> wizardData )
        {
            Contract.Requires( services != null );
            Contract.Requires( nuget != null );
            Contract.Requires( wizardData != null );

            // determine whether the package is already installed
            if ( nuget.IsPackageInstalled( Project, "EntityFramework" ) )
                return;

            var packages = wizardData.Value;
            var selectedId = GetString( "_SelectedEFVersion" );
            var packageVersion = ( from element in packages.Elements( "package" )
                                   let id = (string) element.Attribute( "id" )
                                   where id == selectedId
                                   select (string) element.Attribute( "version" ) ).FirstOrDefault();

            // package version unknown (should only happen if there's an error in the wizard or the vstemplate)
            if ( string.IsNullOrEmpty( packageVersion ) )
                return;

            var packageVersions = new Dictionary<string, string>()
            {
                { "EntityFramework", packageVersion }
            };

            InstallPackages( services, packages, packageVersions );
        }