public static bool FindCompatibleToolFiles(
            this IPackage package,
            string scriptName,
            FrameworkName targetFramework,
            out IPackageFile toolFile)
        {
            if (scriptName.Equals("init.ps1", StringComparison.OrdinalIgnoreCase))
            {
                IPackageFile initFile = package.GetToolFiles()
                                        .FirstOrDefault(a => a.Path.Equals("tools\\init.ps1", StringComparison.OrdinalIgnoreCase));
                if (initFile != null)
                {
                    toolFile = initFile;
                    return(true);
                }

                toolFile = null;
                return(false);
            }

            // this is the case for either install.ps1 or uninstall.ps1
            // search for the correct script according to target framework of the project
            IEnumerable <IPackageFile> toolFiles;

            if (VersionUtility.TryGetCompatibleItems(targetFramework, package.GetToolFiles(), out toolFiles))
            {
                IPackageFile foundToolFile = toolFiles.FirstOrDefault(p => p.EffectivePath.Equals(scriptName, StringComparison.OrdinalIgnoreCase));
                if (foundToolFile != null && !foundToolFile.IsEmptyFolder())
                {
                    toolFile = foundToolFile;
                    return(true);
                }
            }

            toolFile = null;
            return(false);
        }