System.Data.SQLite
Changes On Branch VsInstallerWork
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch VsInstallerWork Excluding Merge-Ins

This is equivalent to a diff from 813e72935f to 91450285a2

2012-01-04
03:04
Merge the VS designer component installer changes to the trunk. check-in: b01877dd2c user: mistachkin tags: trunk
03:01
Use the 'thisAssembly' variable consistently when showing a message box to the interactive user. Closed-Leaf check-in: 91450285a2 user: mistachkin tags: VsInstallerWork
2012-01-03
08:09
Remove unnecessary local variable. check-in: 7918c37463 user: mistachkin tags: VsInstallerWork
2012-01-02
12:14
Work on making the installer tool verify that the core assembly is supported by the requested versions of Visual Studio (i.e. based on the image runtime version). check-in: 16872024de user: mistachkin tags: VsInstallerWork
03:46
Make sure the DbProviderFactory modifications by the installer are logged at the highest priority level and are always logged in 'what-if' mode. check-in: 813e72935f user: mistachkin tags: trunk
2012-01-01
06:06
Cleanup log file name variables used by the installer unit tests. check-in: 98632c4b63 user: mistachkin tags: trunk

Changes to Tests/common.eagle.

   298    298         }
   299    299       }
   300    300   
   301    301       proc tryLoadAssembly { fileName } {
   302    302         set fileName [getBinaryFileName $fileName]
   303    303   
   304    304         if {[catch {set assembly \
   305         -          [object load -loadtype File $fileName]}] == 0} then {
          305  +          [object load -loadtype File -alias $fileName]}] == 0} then {
   306    306           #
   307    307           # NOTE: Now, add the necessary test constraint.
   308    308           #
   309    309           addConstraint [file rootname [file tail $fileName]]
   310    310   
          311  +        #
          312  +        # NOTE: Grab the image runtime version from the assembly because
          313  +        #       several tests rely on it having a certain value.
          314  +        #
          315  +        addConstraint [appendArgs [file tail $fileName] _ \
          316  +            [$assembly ImageRuntimeVersion]]
          317  +
   311    318           #
   312    319           # NOTE: Return the full path of the loaded file.
   313    320           #
   314    321           return $fileName
   315    322         }
   316    323   
   317    324         return ""
................................................................................
   703    710           #
   704    711           checkForSQLite $::test_channel
   705    712   
   706    713           #
   707    714           # NOTE: Report the resource usage prior to running any tests.
   708    715           #
   709    716           reportSQLiteResources $::test_channel
          717  +
          718  +        #
          719  +        # NOTE: Show the active test constraints.
          720  +        #
          721  +        tputs $::test_channel [appendArgs "---- constraints: " \
          722  +            [formatList [lsort [getConstraints]]] \n]
   710    723         }
   711    724       }
   712    725   
   713    726       proc runSQLiteTestEpilogue {} {
   714    727         #
   715    728         # NOTE: Skip running our custom epilogue if the main one has been skipped.
   716    729         #

Changes to Tests/installer.eagle.

    86     86   
    87     87     list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
    88     88         [subst -nobackslashes [readFile $testInstallVs2008LogFile]]] : $error}]
    89     89   } -cleanup {
    90     90     catch {file delete $fileName}
    91     91   
    92     92     unset -nocomplain code output error fileName
    93         -} -constraints \
    94         -{eagle visualStudio2008 file_Installer.exe file_Installer_Test_Vs2008.log} \
    95         --result {0 True}}
           93  +} -constraints {eagle visualStudio2008 System.Data.SQLite.dll_v2.0.50727\
           94  +file_Installer.exe file_Installer_Test_Vs2008.log} -result {0 True}}
    96     95   
    97     96   ###############################################################################
    98     97   
    99     98   runTest {test installer-1.2 {uninstaller tool / Visual Studio 2008} -setup {
   100     99     set fileName [file join [getTemporaryPath] \
   101    100         [file tail $testUninstallVs2008LogFile]]
   102    101   
................................................................................
   118    117   
   119    118     list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
   120    119         [subst -nobackslashes [readFile $testUninstallVs2008LogFile]]] : $error}]
   121    120   } -cleanup {
   122    121     catch {file delete $fileName}
   123    122   
   124    123     unset -nocomplain code output error fileName
   125         -} -constraints \
   126         -{eagle visualStudio2008 file_Installer.exe file_Uninstaller_Test_Vs2008.log} \
   127         --result {0 True}}
          124  +} -constraints {eagle visualStudio2008 System.Data.SQLite.dll_v2.0.50727\
          125  +file_Installer.exe file_Uninstaller_Test_Vs2008.log} -result {0 True}}
   128    126   
   129    127   ###############################################################################
   130    128   
   131    129   runTest {test installer-1.3 {installer tool / Visual Studio 2010} -setup {
   132    130     set fileName [file join [getTemporaryPath] \
   133    131         [file tail $testInstallVs2010LogFile]]
   134    132   
................................................................................
   150    148   
   151    149     list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
   152    150         [subst -nobackslashes [readFile $testInstallVs2010LogFile]]] : $error}]
   153    151   } -cleanup {
   154    152     catch {file delete $fileName}
   155    153   
   156    154     unset -nocomplain code output error fileName
   157         -} -constraints \
   158         -{eagle visualStudio2010 file_Installer.exe file_Installer_Test_Vs2010.log} \
   159         --result {0 True}}
          155  +} -constraints {eagle visualStudio2010 System.Data.SQLite.dll_v4.0.30319\
          156  +file_Installer.exe file_Installer_Test_Vs2010.log} -result {0 True}}
   160    157   
   161    158   ###############################################################################
   162    159   
   163    160   runTest {test installer-1.4 {uninstaller tool / Visual Studio 2010} -setup {
   164    161     set fileName [file join [getTemporaryPath] \
   165    162         [file tail $testUninstallVs2010LogFile]]
   166    163   
................................................................................
   182    179   
   183    180     list $code [expr {$code == 0 ? [string equal [readFile $fileName] \
   184    181         [subst -nobackslashes [readFile $testUninstallVs2010LogFile]]] : $error}]
   185    182   } -cleanup {
   186    183     catch {file delete $fileName}
   187    184   
   188    185     unset -nocomplain code output error fileName
   189         -} -constraints \
   190         -{eagle visualStudio2010 file_Installer.exe file_Uninstaller_Test_Vs2010.log} \
   191         --result {0 True}}
          186  +} -constraints {eagle visualStudio2010 System.Data.SQLite.dll_v4.0.30319\
          187  +file_Installer.exe file_Uninstaller_Test_Vs2010.log} -result {0 True}}
   192    188   
   193    189   ###############################################################################
   194    190   
   195    191   unset -nocomplain testUninstallVs2010LogFile testUninstallVs2008LogFile \
   196    192       testInstallVs2010LogFile testInstallVs2008LogFile installerExeFile \
   197    193       systemDataSQLiteDllFile
   198    194   
   199    195   ###############################################################################
   200    196   
   201    197   runSQLiteTestEpilogue
   202    198   runTestEpilogue

Changes to tools/install/Installer.cs.

    54     54       );
    55     55   
    56     56       ///////////////////////////////////////////////////////////////////////////
    57     57   
    58     58       internal delegate bool VisualStudioRegistryCallback(
    59     59           RegistryKey rootKey,
    60     60           Version vsVersion,
    61         -        Guid packageId,
    62         -        Guid serviceId,
    63         -        Guid dataSourceId,
    64         -        Guid dataProviderId,
           61  +        Installer.Package package,
    65     62           object clientData,
    66     63           bool whatIf,
    67     64           bool verbose,
    68     65           ref string error
    69     66       );
    70     67       #endregion
    71     68   
................................................................................
  1278   1275                   // do nothing.
  1279   1276               }
  1280   1277           }
  1281   1278           #endregion
  1282   1279   
  1283   1280           ///////////////////////////////////////////////////////////////////////
  1284   1281   
         1282  +        #region VersionListMap Class
         1283  +        private sealed class VersionListMap : Dictionary<Version, VersionList>
         1284  +        {
         1285  +            public VersionListMap()
         1286  +            {
         1287  +                // do nothing.
         1288  +            }
         1289  +        }
         1290  +        #endregion
         1291  +
         1292  +        ///////////////////////////////////////////////////////////////////////
         1293  +
         1294  +        #region Package Class
         1295  +        internal sealed class Package
         1296  +        {
         1297  +            #region Public Constructors
         1298  +            public Package()
         1299  +            {
         1300  +                // do nothing.
         1301  +            }
         1302  +            #endregion
         1303  +
         1304  +            ///////////////////////////////////////////////////////////////////
         1305  +
         1306  +            #region Public Properties
         1307  +            private Guid packageId;
         1308  +            public Guid PackageId
         1309  +            {
         1310  +                get { return packageId; }
         1311  +                set { packageId = value; }
         1312  +            }
         1313  +
         1314  +            ///////////////////////////////////////////////////////////////////
         1315  +
         1316  +            private Guid serviceId;
         1317  +            public Guid ServiceId
         1318  +            {
         1319  +                get { return serviceId; }
         1320  +                set { serviceId = value; }
         1321  +            }
         1322  +
         1323  +            ///////////////////////////////////////////////////////////////////
         1324  +
         1325  +            private Guid dataSourceId;
         1326  +            public Guid DataSourceId
         1327  +            {
         1328  +                get { return dataSourceId; }
         1329  +                set { dataSourceId = value; }
         1330  +            }
         1331  +
         1332  +            ///////////////////////////////////////////////////////////////////
         1333  +
         1334  +            private Guid dataProviderId;
         1335  +            public Guid DataProviderId
         1336  +            {
         1337  +                get { return dataProviderId; }
         1338  +                set { dataProviderId = value; }
         1339  +            }
         1340  +
         1341  +            ///////////////////////////////////////////////////////////////////
         1342  +
         1343  +            private Guid adoNetTechnologyId;
         1344  +            public Guid AdoNetTechnologyId
         1345  +            {
         1346  +                get { return adoNetTechnologyId; }
         1347  +                set { adoNetTechnologyId = value; }
         1348  +            }
         1349  +            #endregion
         1350  +        }
         1351  +        #endregion
         1352  +
         1353  +        ///////////////////////////////////////////////////////////////////////
         1354  +
  1285   1355           #region Configuration Class
  1286   1356           private sealed class Configuration
  1287   1357           {
  1288   1358               #region Private Constants
  1289   1359               private const char Switch = '-';
  1290   1360               private const char AltSwitch = '/';
  1291   1361   
................................................................................
  2060   2130   
  2061   2131                       //
  2062   2132                       // NOTE: Show where we are running from and how we were
  2063   2133                       //       invoked.
  2064   2134                       //
  2065   2135                       string location = assembly.Location;
  2066   2136   
         2137  +                    TraceOps.Trace(
         2138  +                        TracePriority.Medium, traceCallback, String.Format(
         2139  +                        "Running executable is: {0}", ForDisplay(location)),
         2140  +                        traceCategory);
         2141  +
  2067   2142                       TraceOps.Trace(
  2068   2143                           TracePriority.Medium, traceCallback, String.Format(
  2069   2144                           "Original command line is: {0}",
  2070   2145                           Environment.CommandLine), traceCategory);
  2071   2146   
  2072   2147                       if (!configuration.whatIf)
  2073   2148                       {
................................................................................
  2112   2187                   {
  2113   2188                       TraceOps.Trace(
  2114   2189                           TracePriority.Highest, traceCallback, e,
  2115   2190                           traceCategory);
  2116   2191   
  2117   2192                       error = "Failed to process configuration.";
  2118   2193                   }
         2194  +
         2195  +                return false;
         2196  +            }
         2197  +
         2198  +            ///////////////////////////////////////////////////////////////////
         2199  +
         2200  +            public static bool CheckRuntimeVersion(
         2201  +                Configuration configuration,
         2202  +                bool strict,
         2203  +                ref string error
         2204  +                )
         2205  +            {
         2206  +                try
         2207  +                {
         2208  +                    if (configuration == null)
         2209  +                    {
         2210  +                        error = "Invalid configuration.";
         2211  +                        return false;
         2212  +                    }
         2213  +
         2214  +                    //
         2215  +                    // NOTE: What version of the runtime was the core (primary)
         2216  +                    //       assembly compiled against (e.g. "v2.0.50727" or
         2217  +                    //       "v4.0.30319").
         2218  +                    //
         2219  +                    string coreImageRuntimeVersion = GetImageRuntimeVersion(
         2220  +                        configuration.coreFileName);
         2221  +
         2222  +                    //
         2223  +                    // TODO: Restrict the configuration based on which image
         2224  +                    //       runtime versions (which more-or-less correspond
         2225  +                    //       to .NET Framework versions) are supported by the
         2226  +                    //       versions of Visual Studio that are installed.
         2227  +                    //
         2228  +                    if (String.IsNullOrEmpty(coreImageRuntimeVersion))
         2229  +                    {
         2230  +                        error = "invalid core file image runtime version";
         2231  +                        return false;
         2232  +                    }
         2233  +                    else if (String.Equals(
         2234  +                            coreImageRuntimeVersion, CLR2ImageRuntimeVersion,
         2235  +                            StringComparison.InvariantCulture))
         2236  +                    {
         2237  +                        //
         2238  +                        // NOTE: For the CLR v2.0 runtime, make sure we disable
         2239  +                        //       any attempt to use it for things that require
         2240  +                        //       an assembly compiled for the CLR v4.0.  It is
         2241  +                        //       uncertain if this is actually a problem in
         2242  +                        //       practice as the CLR v4.0 can load and use an
         2243  +                        //       assembly compiled with the CLR v2.0; however,
         2244  +                        //       since this project offers both configurations,
         2245  +                        //       we currently disallow this mismatch.
         2246  +                        //
         2247  +                        configuration.noNetFx40 = true;
         2248  +                        configuration.noVs2010 = true;
         2249  +
         2250  +                        TraceOps.Trace(
         2251  +                            TracePriority.Medium, traceCallback, String.Format(
         2252  +                            "Assembly is compiled for the .NET Framework {0}, " +
         2253  +                            "support for .NET Framework {1} is now disabled.",
         2254  +                            CLR2ImageRuntimeVersion, CLR4ImageRuntimeVersion),
         2255  +                            traceCategory);
         2256  +                    }
         2257  +                    else if (String.Equals(
         2258  +                            coreImageRuntimeVersion, CLR4ImageRuntimeVersion,
         2259  +                            StringComparison.InvariantCulture))
         2260  +                    {
         2261  +                        //
         2262  +                        // NOTE: For the CLR v4.0 runtime, make sure we disable
         2263  +                        //       any attempt to use it for things that require
         2264  +                        //       an assembly compiled for the CLR v2.0.
         2265  +                        //
         2266  +                        configuration.noNetFx20 = true;
         2267  +                        configuration.noVs2008 = true;
         2268  +
         2269  +                        TraceOps.Trace(
         2270  +                            TracePriority.Medium, traceCallback, String.Format(
         2271  +                            "Assembly is compiled for the .NET Framework {0}, " +
         2272  +                            "support for .NET Framework {1} is now disabled.",
         2273  +                            ForDisplay(CLR4ImageRuntimeVersion),
         2274  +                            ForDisplay(CLR2ImageRuntimeVersion)),
         2275  +                            traceCategory);
         2276  +                    }
         2277  +                    else
         2278  +                    {
         2279  +                        error = String.Format(
         2280  +                            "unsupported core file image runtime version " +
         2281  +                            "{0}, must be {1} or {2}",
         2282  +                            ForDisplay(coreImageRuntimeVersion),
         2283  +                            ForDisplay(CLR2ImageRuntimeVersion),
         2284  +                            ForDisplay(CLR4ImageRuntimeVersion));
         2285  +
         2286  +                        return false;
         2287  +                    }
         2288  +
         2289  +                    return true;
         2290  +                }
         2291  +                catch (Exception e)
         2292  +                {
         2293  +                    TraceOps.Trace(
         2294  +                        TracePriority.Highest, traceCallback, e,
         2295  +                        traceCategory);
         2296  +
         2297  +                    error = "Failed to check image runtime version.";
         2298  +                }
  2119   2299   
  2120   2300                   return false;
  2121   2301               }
  2122   2302               #endregion
  2123   2303   
  2124   2304               ///////////////////////////////////////////////////////////////////
  2125   2305   
................................................................................
  2429   2609               {
  2430   2610                   get { return confirm; }
  2431   2611                   set { confirm = value; }
  2432   2612               }
  2433   2613               #endregion
  2434   2614           }
  2435   2615           #endregion
         2616  +
         2617  +        ///////////////////////////////////////////////////////////////////////
         2618  +
         2619  +        #region FrameworkList Class
         2620  +        private sealed class FrameworkList
         2621  +        {
         2622  +            #region Public Constructors
         2623  +            public FrameworkList()
         2624  +            {
         2625  +                // do nothing.
         2626  +            }
         2627  +            #endregion
         2628  +
         2629  +            ///////////////////////////////////////////////////////////////////
         2630  +
         2631  +            #region Public Methods
         2632  +            private RegistryKey rootKey;
         2633  +            public RegistryKey RootKey
         2634  +            {
         2635  +                get { return rootKey; }
         2636  +                set { rootKey = value; }
         2637  +            }
         2638  +
         2639  +            ///////////////////////////////////////////////////////////////////
         2640  +
         2641  +            private StringList names;
         2642  +            public StringList Names
         2643  +            {
         2644  +                get { return names; }
         2645  +                set { names = value; }
         2646  +            }
         2647  +
         2648  +            ///////////////////////////////////////////////////////////////////
         2649  +
         2650  +            private VersionMap versions;
         2651  +            public VersionMap Versions
         2652  +            {
         2653  +                get { return versions; }
         2654  +                set { versions = value; }
         2655  +            }
         2656  +
         2657  +            ///////////////////////////////////////////////////////////////////
         2658  +
         2659  +            private StringList platformNames;
         2660  +            public StringList PlatformNames
         2661  +            {
         2662  +                get { return platformNames; }
         2663  +                set { platformNames = value; }
         2664  +            }
         2665  +            #endregion
         2666  +        }
         2667  +        #endregion
         2668  +
         2669  +        ///////////////////////////////////////////////////////////////////////
         2670  +
         2671  +        #region VsList Class
         2672  +        private sealed class VsList
         2673  +        {
         2674  +            #region Public Constructors
         2675  +            public VsList()
         2676  +            {
         2677  +                // do nothing.
         2678  +            }
         2679  +            #endregion
         2680  +
         2681  +            ///////////////////////////////////////////////////////////////////
         2682  +
         2683  +            #region Public Properties
         2684  +            private RegistryKey rootKey;
         2685  +            public RegistryKey RootKey
         2686  +            {
         2687  +                get { return rootKey; }
         2688  +                set { rootKey = value; }
         2689  +            }
         2690  +
         2691  +            ///////////////////////////////////////////////////////////////////
         2692  +
         2693  +            private VersionList versions;
         2694  +            public VersionList Versions
         2695  +            {
         2696  +                get { return versions; }
         2697  +                set { versions = value; }
         2698  +            }
         2699  +
         2700  +            ///////////////////////////////////////////////////////////////////
         2701  +
         2702  +            private VersionListMap frameworkVersions;
         2703  +            public VersionListMap FrameworkVersions
         2704  +            {
         2705  +                get { return frameworkVersions; }
         2706  +                set { frameworkVersions = value; }
         2707  +            }
         2708  +
         2709  +            ///////////////////////////////////////////////////////////////////
         2710  +
         2711  +            private VersionList installedVersions;
         2712  +            public VersionList InstalledVersions
         2713  +            {
         2714  +                get { return installedVersions; }
         2715  +                set { installedVersions = value; }
         2716  +            }
         2717  +            #endregion
         2718  +        }
         2719  +        #endregion
  2436   2720           #endregion
  2437   2721   
  2438   2722           ///////////////////////////////////////////////////////////////////////
  2439   2723   
  2440   2724           #region Private Constant Data
  2441   2725           private const string CoreFileName = "System.Data.SQLite.dll";
  2442   2726           private const string LinqFileName = "System.Data.SQLite.Linq.dll";
................................................................................
  2443   2727           private const string DesignerFileName = "SQLite.Designer.dll";
  2444   2728           private const string ProviderName = "SQLite Data Provider";
  2445   2729           private const string ProjectName = "System.Data.SQLite";
  2446   2730           private const string LegacyProjectName = "SQLite";
  2447   2731           private const string InvariantName = "System.Data.SQLite";
  2448   2732           private const string FactoryTypeName = "System.Data.SQLite.SQLiteFactory";
  2449   2733           private const string Description = ".NET Framework Data Provider for SQLite";
         2734  +
         2735  +        ///////////////////////////////////////////////////////////////////////
         2736  +
         2737  +        private const string CLR2ImageRuntimeVersion = "v2.0.50727";
         2738  +        private const string CLR4ImageRuntimeVersion = "v4.0.30319";
  2450   2739   
  2451   2740           ///////////////////////////////////////////////////////////////////////
  2452   2741   
  2453   2742           private const string NameAndValueFormat = "{0}: {1}";
  2454   2743           private const string LogFileSuffix = ".log";
  2455   2744   
  2456   2745           ///////////////////////////////////////////////////////////////////////
................................................................................
  2479   2768   
  2480   2769           private static readonly string XPathForRemoveElement =
  2481   2770               "configuration/system.data/DbProviderFactories/remove[@invariant=\"{0}\"]";
  2482   2771           #endregion
  2483   2772   
  2484   2773           ///////////////////////////////////////////////////////////////////////
  2485   2774   
  2486         -        #region Private Data
         2775  +        #region Private Static Data
  2487   2776           private static Assembly thisAssembly = Assembly.GetExecutingAssembly();
  2488   2777   
  2489   2778           private static string traceCategory = Path.GetFileName(
  2490   2779               thisAssembly.Location);
  2491   2780   
  2492   2781           private static TraceCallback traceCallback = AppTrace;
  2493         -
  2494         -        ///////////////////////////////////////////////////////////////////////
  2495         -
  2496         -        private static RegistryKey frameworkRootKey;
  2497         -        private static StringList frameworkNameList;
  2498         -        private static VersionMap frameworkVersionMap;
  2499         -        private static StringList platformNameList;
  2500         -
  2501         -        ///////////////////////////////////////////////////////////////////////
  2502         -
  2503         -        private static RegistryKey vsRootKey;
  2504         -        private static VersionList vsVersionList;
  2505         -        private static Guid? vsPackageId;
  2506         -        private static Guid? vsServiceId;
  2507         -        private static Guid? vsDataSourcesId;
  2508         -        private static Guid? vsDataProviderId;
  2509         -        private static Guid? vsAdoNetTechnologyId;
  2510   2782           #endregion
  2511   2783   
  2512   2784           ///////////////////////////////////////////////////////////////////////
  2513   2785   
  2514   2786           #region Trace Handling
  2515   2787           private static string GetLogFileName()
  2516   2788           {
................................................................................
  2575   2847               return result;
  2576   2848           }
  2577   2849           #endregion
  2578   2850   
  2579   2851           ///////////////////////////////////////////////////////////////////////
  2580   2852   
  2581   2853           #region .NET Framework Handling
         2854  +        private static string GetImageRuntimeVersion(
         2855  +            string fileName
         2856  +            )
         2857  +        {
         2858  +            try
         2859  +            {
         2860  +                Assembly assembly =
         2861  +                    Assembly.ReflectionOnlyLoadFrom(fileName); /* throw */
         2862  +
         2863  +                if (assembly != null)
         2864  +                    return assembly.ImageRuntimeVersion;
         2865  +            }
         2866  +            catch
         2867  +            {
         2868  +                // do nothing.
         2869  +            }
         2870  +
         2871  +            return null;
         2872  +        }
         2873  +
         2874  +        ///////////////////////////////////////////////////////////////////////
         2875  +
  2582   2876           private static string GetFrameworkDirectory(
  2583   2877               RegistryKey rootKey,
  2584   2878               Version frameworkVersion,
  2585   2879               bool whatIf,
  2586   2880               bool verbose
  2587   2881               )
  2588   2882           {
................................................................................
  2722   3016               return null;
  2723   3017           }
  2724   3018           #endregion
  2725   3019   
  2726   3020           ///////////////////////////////////////////////////////////////////////
  2727   3021   
  2728   3022           #region Per-Framework/Platform Handling
  2729         -        private static void InitializeAllFrameworks(
  2730         -            Configuration configuration
         3023  +        private static void InitializeFrameworkList(
         3024  +            Configuration configuration,
         3025  +            ref FrameworkList frameworkList
  2731   3026               )
  2732   3027           {
  2733         -            if (frameworkRootKey == null)
  2734         -                frameworkRootKey = Registry.LocalMachine;
         3028  +            if (frameworkList == null)
         3029  +                frameworkList = new FrameworkList();
  2735   3030   
  2736         -            if (frameworkNameList == null)
         3031  +            if (frameworkList.RootKey == null)
         3032  +                frameworkList.RootKey = Registry.LocalMachine;
         3033  +
         3034  +            ///////////////////////////////////////////////////////////////////
         3035  +
         3036  +            if (frameworkList.Names == null)
  2737   3037               {
  2738         -                frameworkNameList = new StringList();
         3038  +                frameworkList.Names = new StringList();
         3039  +
         3040  +                if ((configuration == null) || !configuration.NoDesktop)
         3041  +                    frameworkList.Names.Add(".NETFramework");
         3042  +
         3043  +                if ((configuration == null) || !configuration.NoCompact)
         3044  +                {
         3045  +                    frameworkList.Names.Add(".NETCompactFramework");
         3046  +                    frameworkList.Names.Add(".NETCompactFramework");
         3047  +                    frameworkList.Names.Add(".NETCompactFramework");
         3048  +                }
         3049  +            }
         3050  +
         3051  +            ///////////////////////////////////////////////////////////////////
         3052  +
         3053  +            if (frameworkList.Versions == null)
         3054  +            {
         3055  +                frameworkList.Versions = new VersionMap();
  2739   3056   
  2740   3057                   if ((configuration == null) || !configuration.NoDesktop)
  2741         -                    frameworkNameList.Add(".NETFramework");
         3058  +                {
         3059  +                    VersionList desktopVersionList = new VersionList();
         3060  +
         3061  +                    if ((configuration == null) || !configuration.NoNetFx20)
         3062  +                        desktopVersionList.Add(new Version(2, 0, 50727));
         3063  +
         3064  +                    if ((configuration == null) || !configuration.NoNetFx40)
         3065  +                        desktopVersionList.Add(new Version(4, 0, 30319));
         3066  +
         3067  +                    frameworkList.Versions.Add(".NETFramework",
         3068  +                        desktopVersionList);
         3069  +                }
  2742   3070   
  2743   3071                   if ((configuration == null) || !configuration.NoCompact)
  2744   3072                   {
  2745         -                    frameworkNameList.Add(".NETCompactFramework");
  2746         -                    frameworkNameList.Add(".NETCompactFramework");
  2747         -                    frameworkNameList.Add(".NETCompactFramework");
         3073  +                    frameworkList.Versions.Add(".NETCompactFramework",
         3074  +                        new VersionList(new Version[] {
         3075  +                        new Version(2, 0, 0, 0), new Version(3, 5, 0, 0)
         3076  +                    }));
  2748   3077                   }
  2749   3078               }
  2750   3079   
  2751         -            if (frameworkVersionMap == null)
  2752         -                frameworkVersionMap = new VersionMap();
         3080  +            ///////////////////////////////////////////////////////////////////
  2753   3081   
  2754         -            if ((configuration == null) || !configuration.NoDesktop)
         3082  +            if (frameworkList.PlatformNames == null)
  2755   3083               {
  2756         -                VersionList desktopVersionList = new VersionList();
  2757         -
  2758         -                if ((configuration == null) || !configuration.NoNetFx20)
  2759         -                    desktopVersionList.Add(new Version(2, 0, 50727));
  2760         -
  2761         -                if ((configuration == null) || !configuration.NoNetFx40)
  2762         -                    desktopVersionList.Add(new Version(4, 0, 30319));
  2763         -
  2764         -                frameworkVersionMap.Add(".NETFramework", desktopVersionList);
  2765         -            }
  2766         -
  2767         -            if ((configuration == null) || !configuration.NoCompact)
  2768         -            {
  2769         -                frameworkVersionMap.Add(".NETCompactFramework", new VersionList(
  2770         -                    new Version[] {
  2771         -                    new Version(2, 0, 0, 0), new Version(3, 5, 0, 0)
  2772         -                }));
  2773         -            }
  2774         -
  2775         -            if (platformNameList == null)
  2776         -            {
  2777         -                platformNameList = new StringList();
         3084  +                frameworkList.PlatformNames = new StringList();
  2778   3085   
  2779   3086                   if ((configuration == null) || !configuration.NoDesktop)
  2780         -                    platformNameList.Add(null);
         3087  +                    frameworkList.PlatformNames.Add(null);
  2781   3088   
  2782   3089                   if ((configuration == null) || !configuration.NoCompact)
  2783   3090                   {
  2784         -                    platformNameList.Add("PocketPC");
  2785         -                    platformNameList.Add("Smartphone");
  2786         -                    platformNameList.Add("WindowsCE");
         3091  +                    frameworkList.PlatformNames.Add("PocketPC");
         3092  +                    frameworkList.PlatformNames.Add("Smartphone");
         3093  +                    frameworkList.PlatformNames.Add("WindowsCE");
  2787   3094                   }
  2788   3095               }
  2789   3096           }
  2790   3097   
  2791   3098           ///////////////////////////////////////////////////////////////////////
  2792   3099   
  2793   3100           private static bool HaveFramework(
................................................................................
  2808   3115   
  2809   3116               using (MockRegistryKey key = RegistryHelper.OpenSubKey(
  2810   3117                       rootKey, keyName, false, whatIf, verbose))
  2811   3118               {
  2812   3119                   if (key == null)
  2813   3120                       return false;
  2814   3121   
  2815         -                if (platformName != null) // NOTE: Skip non-desktop frameworks.
         3122  +                if (platformName != null) // NOTE: Skip non-desktop.
  2816   3123                       return true;
  2817   3124   
  2818   3125                   string directory = GetFrameworkDirectory(
  2819   3126                       rootKey, frameworkVersion, whatIf, verbose);
  2820   3127   
  2821   3128                   if (String.IsNullOrEmpty(directory))
  2822   3129                       return false;
................................................................................
  2827   3134                   return true;
  2828   3135               }
  2829   3136           }
  2830   3137   
  2831   3138           ///////////////////////////////////////////////////////////////////////
  2832   3139   
  2833   3140           private static bool ForEachFrameworkConfig(
         3141  +            FrameworkList frameworkList,
  2834   3142               FrameworkConfigCallback callback,
  2835   3143               string invariant,
  2836   3144               string name,
  2837   3145               string description,
  2838   3146               string typeName,
  2839   3147               AssemblyName assemblyName,
  2840   3148               object clientData,
  2841   3149               bool whatIf,
  2842   3150               bool verbose,
  2843   3151               ref bool saved,
  2844   3152               ref string error
  2845   3153               )
  2846   3154           {
  2847         -            RegistryKey rootKey = frameworkRootKey;
         3155  +            if (frameworkList == null)
         3156  +            {
         3157  +                error = "invalid framework list";
         3158  +                return false;
         3159  +            }
         3160  +
         3161  +            RegistryKey rootKey = frameworkList.RootKey;
  2848   3162   
  2849   3163               if (rootKey == null)
  2850   3164               {
  2851   3165                   error = "invalid root key";
  2852   3166                   return false;
  2853   3167               }
  2854   3168   
................................................................................
  2855   3169               if (!Object.ReferenceEquals(rootKey, Registry.CurrentUser) &&
  2856   3170                   !Object.ReferenceEquals(rootKey, Registry.LocalMachine))
  2857   3171               {
  2858   3172                   error = "root key must be per-user or per-machine";
  2859   3173                   return false;
  2860   3174               }
  2861   3175   
  2862         -            if (frameworkNameList == null)
         3176  +            if (frameworkList.Names == null)
  2863   3177               {
  2864   3178                   error = "no framework names found";
  2865   3179                   return false;
  2866   3180               }
  2867   3181   
  2868         -            if (frameworkVersionMap == null)
         3182  +            if (frameworkList.Versions == null)
  2869   3183               {
  2870   3184                   error = "no framework versions found";
  2871   3185                   return false;
  2872   3186               }
  2873   3187   
  2874         -            if (platformNameList == null)
         3188  +            if (frameworkList.PlatformNames == null)
  2875   3189               {
  2876   3190                   error = "no platform names found";
  2877   3191                   return false;
  2878   3192               }
  2879   3193   
  2880         -            if (frameworkNameList.Count != platformNameList.Count)
         3194  +            if (frameworkList.Names.Count != frameworkList.PlatformNames.Count)
  2881   3195               {
  2882   3196                   error = String.Format("framework name count {0} does not " +
  2883         -                    "match platform name count {1}", frameworkNameList.Count,
  2884         -                    platformNameList.Count);
         3197  +                    "match platform name count {1}", frameworkList.Names.Count,
         3198  +                    frameworkList.PlatformNames.Count);
  2885   3199   
  2886   3200                   return false;
  2887   3201               }
  2888   3202   
  2889         -            for (int index = 0; index < frameworkNameList.Count; index++)
         3203  +            for (int index = 0; index < frameworkList.Names.Count; index++)
  2890   3204               {
  2891   3205                   //
  2892   3206                   // NOTE: Grab the name of the framework (e.g. ".NETFramework")
  2893   3207                   //       and the name of the platform (e.g. "WindowsCE").
  2894   3208                   //
  2895         -                string frameworkName = frameworkNameList[index];
  2896         -                string platformName = platformNameList[index];
         3209  +                string frameworkName = frameworkList.Names[index];
         3210  +                string platformName = frameworkList.PlatformNames[index];
  2897   3211   
  2898   3212                   //
  2899   3213                   // NOTE: Skip all non-desktop frameworks (i.e. if the platform
  2900   3214                   //       name is not null).
  2901   3215                   //
  2902   3216                   if (platformName != null)
  2903   3217                       continue;
................................................................................
  2904   3218   
  2905   3219                   //
  2906   3220                   // NOTE: Grab the supported versions of this particular
  2907   3221                   //       framework.
  2908   3222                   //
  2909   3223                   VersionList frameworkVersionList;
  2910   3224   
  2911         -                if (!frameworkVersionMap.TryGetValue(
         3225  +                if (!frameworkList.Versions.TryGetValue(
  2912   3226                           frameworkName, out frameworkVersionList) ||
  2913   3227                       (frameworkVersionList == null))
  2914   3228                   {
  2915   3229                       continue;
  2916   3230                   }
  2917   3231   
  2918   3232                   foreach (Version frameworkVersion in frameworkVersionList)
................................................................................
  3006   3320   
  3007   3321               return true;
  3008   3322           }
  3009   3323   
  3010   3324           ///////////////////////////////////////////////////////////////////////
  3011   3325   
  3012   3326           private static bool ForEachFrameworkRegistry(
         3327  +            FrameworkList frameworkList,
  3013   3328               FrameworkRegistryCallback callback,
  3014   3329               object clientData,
  3015   3330               bool whatIf,
  3016   3331               bool verbose,
  3017   3332               ref string error
  3018   3333               )
  3019   3334           {
  3020         -            RegistryKey rootKey = frameworkRootKey;
         3335  +            if (frameworkList == null)
         3336  +            {
         3337  +                error = "invalid framework list";
         3338  +                return false;
         3339  +            }
         3340  +
         3341  +            RegistryKey rootKey = frameworkList.RootKey;
  3021   3342   
  3022   3343               if (rootKey == null)
  3023   3344               {
  3024   3345                   error = "invalid root key";
  3025   3346                   return false;
  3026   3347               }
  3027   3348   
................................................................................
  3028   3349               if (!Object.ReferenceEquals(rootKey, Registry.CurrentUser) &&
  3029   3350                   !Object.ReferenceEquals(rootKey, Registry.LocalMachine))
  3030   3351               {
  3031   3352                   error = "root key must be per-user or per-machine";
  3032   3353                   return false;
  3033   3354               }
  3034   3355   
  3035         -            if (frameworkNameList == null)
         3356  +            if (frameworkList.Names == null)
  3036   3357               {
  3037   3358                   error = "no framework names found";
  3038   3359                   return false;
  3039   3360               }
  3040   3361   
  3041         -            if (frameworkVersionMap == null)
         3362  +            if (frameworkList.Versions == null)
  3042   3363               {
  3043   3364                   error = "no framework versions found";
  3044   3365                   return false;
  3045   3366               }
  3046   3367   
  3047         -            if (platformNameList == null)
         3368  +            if (frameworkList.PlatformNames == null)
  3048   3369               {
  3049   3370                   error = "no platform names found";
  3050   3371                   return false;
  3051   3372               }
  3052   3373   
  3053         -            if (frameworkNameList.Count != platformNameList.Count)
         3374  +            if (frameworkList.Names.Count != frameworkList.PlatformNames.Count)
  3054   3375               {
  3055   3376                   error = String.Format("framework name count {0} does not " +
  3056         -                    "match platform name count {1}", frameworkNameList.Count,
  3057         -                    platformNameList.Count);
         3377  +                    "match platform name count {1}", frameworkList.Names.Count,
         3378  +                    frameworkList.PlatformNames.Count);
  3058   3379   
  3059   3380                   return false;
  3060   3381               }
  3061   3382   
  3062         -            for (int index = 0; index < frameworkNameList.Count; index++)
         3383  +            for (int index = 0; index < frameworkList.Names.Count; index++)
  3063   3384               {
  3064   3385                   //
  3065   3386                   // NOTE: Grab the name of the framework (e.g. ".NETFramework")
  3066   3387                   //       and the name of the platform (e.g. "WindowsCE").
  3067   3388                   //
  3068         -                string frameworkName = frameworkNameList[index];
  3069         -                string platformName = platformNameList[index];
         3389  +                string frameworkName = frameworkList.Names[index];
         3390  +                string platformName = frameworkList.PlatformNames[index];
  3070   3391   
  3071   3392                   //
  3072   3393                   // NOTE: Grab the supported versions of this particular
  3073   3394                   //       framework.
  3074   3395                   //
  3075   3396                   VersionList frameworkVersionList;
  3076   3397   
  3077         -                if (!frameworkVersionMap.TryGetValue(
         3398  +                if (!frameworkList.Versions.TryGetValue(
  3078   3399                           frameworkName, out frameworkVersionList) ||
  3079   3400                       (frameworkVersionList == null))
  3080   3401                   {
  3081   3402                       continue;
  3082   3403                   }
  3083   3404   
  3084   3405                   foreach (Version frameworkVersion in frameworkVersionList)
................................................................................
  3117   3438               return true;
  3118   3439           }
  3119   3440           #endregion
  3120   3441   
  3121   3442           ///////////////////////////////////////////////////////////////////////
  3122   3443   
  3123   3444           #region Per-Visual Studio Version Handling
  3124         -        private static void InitializeAllVsVersions(
  3125         -            Configuration configuration
  3126         -            )
  3127         -        {
  3128         -            if (vsRootKey == null)
  3129         -                vsRootKey = Registry.LocalMachine;
  3130         -
  3131         -            if (vsAdoNetTechnologyId == null)
  3132         -                vsAdoNetTechnologyId = new Guid(
  3133         -                    "77AB9A9D-78B9-4BA7-91AC-873F5338F1D2");
  3134         -
  3135         -            if (vsPackageId == null)
  3136         -                vsPackageId = new Guid(
  3137         -                    "DCBE6C8D-0E57-4099-A183-98FF74C64D9C");
  3138         -
  3139         -            if (vsServiceId == null)
  3140         -                vsServiceId = new Guid(
  3141         -                    "DCBE6C8D-0E57-4099-A183-98FF74C64D9D");
  3142         -
  3143         -            if (vsDataSourcesId == null)
  3144         -                vsDataSourcesId = new Guid(
  3145         -                    "0EBAAB6E-CA80-4B4A-8DDF-CBE6BF058C71");
  3146         -
  3147         -            if (vsDataProviderId == null)
  3148         -                vsDataProviderId = new Guid(
  3149         -                    "0EBAAB6E-CA80-4B4A-8DDF-CBE6BF058C70");
  3150         -
  3151         -            if (vsVersionList == null)
  3152         -            {
  3153         -                vsVersionList = new VersionList();
  3154         -
  3155         -                // vsVersionList.Add(new Version(8, 0)); // Visual Studio 2005
         3445  +        private static void InitializeVsList(
         3446  +            Configuration configuration,
         3447  +            ref VsList vsList
         3448  +            )
         3449  +        {
         3450  +            if (vsList == null)
         3451  +                vsList = new VsList();
         3452  +
         3453  +            if (vsList.RootKey == null)
         3454  +                vsList.RootKey = Registry.LocalMachine;
         3455  +
         3456  +            if (vsList.Versions == null)
         3457  +            {
         3458  +                vsList.Versions = new VersionList();
         3459  +
         3460  +                // vsList.Versions.Add(new Version(8, 0)); // Visual Studio 2005
         3461  +
         3462  +                if ((configuration == null) || !configuration.NoVs2008)
         3463  +                    vsList.Versions.Add(new Version(9, 0)); // Visual Studio 2008
         3464  +
         3465  +                if ((configuration == null) || !configuration.NoVs2010)
         3466  +                    vsList.Versions.Add(new Version(10, 0));// Visual Studio 2010
         3467  +            }
         3468  +
         3469  +            if (vsList.FrameworkVersions == null)
         3470  +            {
         3471  +                vsList.FrameworkVersions = new VersionListMap();
         3472  +
         3473  +                // vsList.FrameworkVersions.Add(new Version(8, 0),
         3474  +                //     new VersionList(new Version[] {
         3475  +                //         new Version(2, 0, 50727) }));
  3156   3476   
  3157   3477                   if ((configuration == null) || !configuration.NoVs2008)
  3158         -                    vsVersionList.Add(new Version(9, 0)); // Visual Studio 2008
         3478  +                    vsList.FrameworkVersions.Add(new Version(9, 0),
         3479  +                        new VersionList(new Version[] {
         3480  +                            new Version(2, 0, 50727) }));
  3159   3481   
  3160   3482                   if ((configuration == null) || !configuration.NoVs2010)
  3161         -                    vsVersionList.Add(new Version(10, 0));// Visual Studio 2010
         3483  +                    vsList.FrameworkVersions.Add(new Version(10, 0),
         3484  +                        new VersionList(new Version[] {
         3485  +                            new Version(2, 0, 50727),
         3486  +                                new Version(4, 0, 30319) }));
  3162   3487               }
  3163   3488           }
  3164   3489   
  3165   3490           ///////////////////////////////////////////////////////////////////////
  3166   3491   
  3167   3492           private static bool HaveVsVersion(
  3168   3493               RegistryKey rootKey,
  3169   3494               Version vsVersion,
  3170   3495               bool whatIf,
  3171   3496               bool verbose
  3172   3497               )
  3173   3498           {
         3499  +            if (vsVersion == null)
         3500  +                return false;
         3501  +
  3174   3502               string format = "Software\\Microsoft\\VisualStudio\\{0}";
  3175   3503               string keyName = String.Format(format, vsVersion);
  3176   3504   
  3177   3505               using (MockRegistryKey key = RegistryHelper.OpenSubKey(
  3178   3506                       rootKey, keyName, false, whatIf, verbose))
  3179   3507               {
  3180   3508                   if (key == null)
................................................................................
  3197   3525                   return true;
  3198   3526               }
  3199   3527           }
  3200   3528   
  3201   3529           ///////////////////////////////////////////////////////////////////////
  3202   3530   
  3203   3531           private static bool ForEachVsVersionRegistry(
         3532  +            VsList vsList,
  3204   3533               VisualStudioRegistryCallback callback,
  3205         -            Guid packageId,
  3206         -            Guid serviceId,
  3207         -            Guid dataSourceId,
  3208         -            Guid dataProviderId,
         3534  +            Package package,
  3209   3535               object clientData,
  3210   3536               bool whatIf,
  3211   3537               bool verbose,
  3212   3538               ref string error
  3213   3539               )
  3214   3540           {
  3215         -            RegistryKey rootKey = vsRootKey;
         3541  +            if (vsList == null)
         3542  +            {
         3543  +                error = "invalid VS list";
         3544  +                return false;
         3545  +            }
         3546  +
         3547  +            RegistryKey rootKey = vsList.RootKey;
  3216   3548   
  3217   3549               if (rootKey == null)
  3218   3550               {
  3219   3551                   error = "invalid root key";
  3220   3552                   return false;
  3221   3553               }
  3222   3554   
................................................................................
  3223   3555               if (!Object.ReferenceEquals(rootKey, Registry.CurrentUser) &&
  3224   3556                   !Object.ReferenceEquals(rootKey, Registry.LocalMachine))
  3225   3557               {
  3226   3558                   error = "root key must be per-user or per-machine";
  3227   3559                   return false;
  3228   3560               }
  3229   3561   
  3230         -            if (vsVersionList == null)
         3562  +            if (vsList.Versions == null)
  3231   3563               {
  3232   3564                   error = "no VS versions found";
  3233   3565                   return false;
  3234   3566               }
  3235   3567   
  3236         -            foreach (Version vsVersion in vsVersionList)
         3568  +            foreach (Version vsVersion in vsList.Versions)
  3237   3569               {
  3238   3570                   TraceOps.Trace(
  3239   3571                       TracePriority.Lower, traceCallback, String.Format(
  3240   3572                       "vsVersion = {0}", ForDisplay(vsVersion)),
  3241   3573                       traceCategory);
  3242   3574   
  3243   3575                   if (!HaveVsVersion(rootKey, vsVersion, whatIf, verbose))
................................................................................
  3249   3581                       continue;
  3250   3582                   }
  3251   3583   
  3252   3584                   if (callback == null)
  3253   3585                       continue;
  3254   3586   
  3255   3587                   if (!callback(
  3256         -                        rootKey, vsVersion, packageId, serviceId,
  3257         -                        dataSourceId, dataProviderId, clientData, whatIf,
         3588  +                        rootKey, vsVersion, package, clientData, whatIf,
  3258   3589                           verbose, ref error))
  3259   3590                   {
  3260   3591                       return false;
  3261   3592                   }
  3262   3593               }
  3263   3594   
  3264   3595               return true;
................................................................................
  3606   3937           ///////////////////////////////////////////////////////////////////////
  3607   3938   
  3608   3939           #region Visual Studio Handling
  3609   3940           private static string GetVsKeyName(
  3610   3941               Version vsVersion
  3611   3942               )
  3612   3943           {
         3944  +            if (vsVersion == null)
         3945  +                return null;
         3946  +
  3613   3947               return String.Format("Software\\Microsoft\\VisualStudio\\{0}",
  3614   3948                   vsVersion);
  3615   3949           }
         3950  +
         3951  +        ///////////////////////////////////////////////////////////////////////
         3952  +
         3953  +        #region Visual Studio Version Handling
         3954  +        private static bool AddVsVersion(
         3955  +            RegistryKey rootKey,
         3956  +            Version vsVersion,
         3957  +            Package package,
         3958  +            object clientData,
         3959  +            bool whatIf,
         3960  +            bool verbose,
         3961  +            ref string error
         3962  +            )
         3963  +        {
         3964  +            if (vsVersion != null)
         3965  +            {
         3966  +                VsList vsList = clientData as VsList;
         3967  +
         3968  +                if (vsList != null)
         3969  +                {
         3970  +                    if (vsList.InstalledVersions == null)
         3971  +                        vsList.InstalledVersions = new VersionList();
         3972  +
         3973  +                    if (!vsList.InstalledVersions.Contains(vsVersion))
         3974  +                        vsList.InstalledVersions.Add(vsVersion);
         3975  +                }
         3976  +            }
         3977  +
         3978  +            return true;
         3979  +        }
         3980  +        #endregion
  3616   3981   
  3617   3982           ///////////////////////////////////////////////////////////////////////
  3618   3983   
  3619   3984           #region Visual Studio Data Source Handling
  3620   3985           private static bool AddVsDataSource(
  3621   3986               RegistryKey rootKey,
  3622   3987               Version vsVersion,
  3623         -            Guid dataSourceId,
  3624         -            Guid dataProviderId,
         3988  +            Package package,
  3625   3989               bool whatIf,
  3626   3990               bool verbose,
  3627   3991               ref string error
  3628   3992               )
  3629   3993           {
         3994  +            if (vsVersion == null)
         3995  +            {
         3996  +                error = "invalid VS version";
         3997  +                return false;
         3998  +            }
         3999  +
         4000  +            if (package == null)
         4001  +            {
         4002  +                error = "invalid VS package";
         4003  +                return false;
         4004  +            }
         4005  +
  3630   4006               string keyName = GetVsKeyName(vsVersion);
  3631   4007   
  3632   4008               using (MockRegistryKey key = RegistryHelper.OpenSubKey(
  3633   4009                       rootKey, keyName, false, whatIf, verbose))
  3634   4010               {
  3635   4011                   if (key == null)
  3636   4012                   {
................................................................................
  3649   4025                           error = String.Format(
  3650   4026                               "could not open registry key: {0}\\DataSources",
  3651   4027                               key);
  3652   4028   
  3653   4029                           return false;
  3654   4030                       }
  3655   4031   
  3656         -                    using (MockRegistryKey dataSourceKey = RegistryHelper.CreateSubKey(
  3657         -                            subKey, dataSourceId.ToString(VsIdFormat), whatIf,
  3658         -                            verbose))
         4032  +                    using (MockRegistryKey dataSourceKey =
         4033  +                            RegistryHelper.CreateSubKey(subKey,
         4034  +                            package.DataSourceId.ToString(VsIdFormat),
         4035  +                            whatIf, verbose))
  3659   4036                       {
  3660   4037                           if (dataSourceKey == null)
  3661   4038                           {
  3662   4039                               error = String.Format(
  3663         -                                "could not create registry key: {0}\\{1}",
  3664         -                                key, dataSourceId.ToString(VsIdFormat));
         4040  +                                "could not create registry key: {0}\\{1}", key,
         4041  +                                package.DataSourceId.ToString(VsIdFormat));
  3665   4042   
  3666   4043                               return false;
  3667   4044                           }
  3668   4045   
  3669   4046                           RegistryHelper.SetValue(
  3670   4047                               dataSourceKey, null, String.Format(
  3671   4048                               "{0} Database File", ProjectName), whatIf,
  3672   4049                               verbose);
  3673   4050   
  3674   4051                           RegistryHelper.CreateSubKey(dataSourceKey,
  3675   4052                               String.Format("SupportingProviders\\{0}",
  3676         -                            dataProviderId.ToString(VsIdFormat)), whatIf,
  3677         -                            verbose);
         4053  +                            package.DataProviderId.ToString(VsIdFormat)),
         4054  +                            whatIf, verbose);
  3678   4055                       }
  3679   4056                   }
  3680   4057               }
  3681   4058   
  3682   4059               return true;
  3683   4060           }
  3684   4061   
  3685   4062           ///////////////////////////////////////////////////////////////////////
  3686   4063   
  3687   4064           private static bool RemoveVsDataSource(
  3688   4065               RegistryKey rootKey,
  3689   4066               Version vsVersion,
  3690         -            Guid dataSourceId,
         4067  +            Package package,
  3691   4068               bool whatIf,
  3692   4069               bool verbose,
  3693   4070               ref string error
  3694   4071               )
  3695   4072           {
         4073  +            if (vsVersion == null)
         4074  +            {
         4075  +                error = "invalid VS version";
         4076  +                return false;
         4077  +            }
         4078  +
         4079  +            if (package == null)
         4080  +            {
         4081  +                error = "invalid VS package";
         4082  +                return false;
         4083  +            }
         4084  +
  3696   4085               string keyName = GetVsKeyName(vsVersion);
  3697   4086   
  3698   4087               using (MockRegistryKey key = RegistryHelper.OpenSubKey(
  3699   4088                       rootKey, keyName, false, whatIf, verbose))
  3700   4089               {
  3701   4090                   if (key == null)
  3702   4091                   {
................................................................................
  3716   4105                               "could not open registry key: {0}\\DataSources",
  3717   4106                               key);
  3718   4107   
  3719   4108                           return false;
  3720   4109                       }
  3721   4110   
  3722   4111                       RegistryHelper.DeleteSubKeyTree(
  3723         -                        subKey, dataSourceId.ToString(VsIdFormat), whatIf,
  3724         -                        verbose);
         4112  +                        subKey, package.DataSourceId.ToString(VsIdFormat),
         4113  +                        whatIf, verbose);
  3725   4114                   }
  3726   4115               }
  3727   4116   
  3728   4117               return true;
  3729   4118           }
  3730   4119   
  3731   4120           ///////////////////////////////////////////////////////////////////////
  3732   4121   
  3733   4122           private static bool ProcessVsDataSource(
  3734   4123               RegistryKey rootKey,
  3735   4124               Version vsVersion,
  3736         -            Guid packageId, /* NOT USED */
  3737         -            Guid serviceId, /* NOT USED */
  3738         -            Guid dataSourceId,
  3739         -            Guid dataProviderId,
         4125  +            Package package,
  3740   4126               object clientData,
  3741   4127               bool whatIf,
  3742   4128               bool verbose,
  3743   4129               ref string error
  3744   4130               )
  3745   4131           {
         4132  +            if (package == null)
         4133  +            {
         4134  +                error = "invalid VS package";
         4135  +                return false;
         4136  +            }
         4137  +
  3746   4138               AnyPair<string, bool> pair = clientData as AnyPair<string, bool>;
  3747   4139   
  3748   4140               if (pair == null)
  3749   4141               {
  3750   4142                   error = "invalid VS callback data";
  3751   4143                   return false;
  3752   4144               }
  3753   4145   
  3754   4146               if (pair.Y)
  3755   4147               {
  3756   4148                   return AddVsDataSource(
  3757         -                    rootKey, vsVersion, dataSourceId, dataProviderId,
  3758         -                    whatIf, verbose, ref error);
         4149  +                    rootKey, vsVersion, package, whatIf, verbose, ref error);
  3759   4150               }
  3760   4151               else
  3761   4152               {
  3762   4153                   return RemoveVsDataSource(
  3763         -                    rootKey, vsVersion, dataSourceId, whatIf, verbose,
  3764         -                    ref error);
         4154  +                    rootKey, vsVersion, package, whatIf, verbose, ref error);
  3765   4155               }
  3766   4156           }
  3767   4157           #endregion
  3768   4158   
  3769   4159           ///////////////////////////////////////////////////////////////////////
  3770   4160   
  3771   4161           #region Visual Studio Data Provider Handling
  3772   4162           private static bool AddVsDataProvider(
  3773   4163               RegistryKey rootKey,
  3774   4164               Version vsVersion,
  3775         -            Guid serviceId,
  3776         -            Guid dataProviderId,
         4165  +            Package package,
  3777   4166               string fileName,
  3778   4167               bool whatIf,
  3779   4168               bool verbose,
  3780   4169               ref string error
  3781   4170               )
  3782   4171           {
  3783         -            if (vsAdoNetTechnologyId == null)
         4172  +            if (vsVersion == null)
  3784   4173               {
  3785         -                error = "invalid ADO.NET technology Id";
         4174  +                error = "invalid VS version";
         4175  +                return false;
         4176  +            }
         4177  +
         4178  +            if (package == null)
         4179  +            {
         4180  +                error = "invalid VS package";
  3786   4181                   return false;
  3787   4182               }
  3788   4183   
  3789   4184               string keyName = GetVsKeyName(vsVersion);
  3790   4185   
  3791   4186               using (MockRegistryKey key = RegistryHelper.OpenSubKey(
  3792   4187                       rootKey, keyName, false, whatIf, verbose))
................................................................................
  3808   4203                           error = String.Format(
  3809   4204                               "could not open registry key: {0}\\DataProviders",
  3810   4205                               key);
  3811   4206   
  3812   4207                           return false;
  3813   4208                       }
  3814   4209   
  3815         -                    using (MockRegistryKey dataProviderKey = RegistryHelper.CreateSubKey(
  3816         -                            subKey, dataProviderId.ToString(VsIdFormat), whatIf,
  3817         -                            verbose))
         4210  +                    using (MockRegistryKey dataProviderKey =
         4211  +                            RegistryHelper.CreateSubKey(subKey,
         4212  +                            package.DataProviderId.ToString(VsIdFormat),
         4213  +                            whatIf, verbose))
  3818   4214                       {
  3819   4215                           if (dataProviderKey == null)
  3820   4216                           {
  3821   4217                               error = String.Format(
  3822         -                                "could not create registry key: {0}\\{1}",
  3823         -                                key, dataProviderId.ToString(VsIdFormat));
         4218  +                                "could not create registry key: {0}\\{1}", key,
         4219  +                                package.DataProviderId.ToString(VsIdFormat));
  3824   4220   
  3825   4221                               return false;
  3826   4222                           }
  3827   4223   
  3828   4224                           RegistryHelper.SetValue(
  3829   4225                               dataProviderKey, null, Description, whatIf,
  3830   4226                               verbose);
................................................................................
  3831   4227   
  3832   4228                           RegistryHelper.SetValue(
  3833   4229                               dataProviderKey, "InvariantName", InvariantName,
  3834   4230                               whatIf, verbose);
  3835   4231   
  3836   4232                           RegistryHelper.SetValue(
  3837   4233                               dataProviderKey, "Technology",
  3838         -                            ((Guid)vsAdoNetTechnologyId).ToString(VsIdFormat),
         4234  +                            package.AdoNetTechnologyId.ToString(VsIdFormat),
  3839   4235                               whatIf, verbose);
  3840   4236   
  3841   4237                           RegistryHelper.SetValue(
  3842   4238                               dataProviderKey, "CodeBase", fileName, whatIf,
  3843   4239                               verbose);
  3844   4240   
  3845   4241                           RegistryHelper.SetValue(
  3846   4242                               dataProviderKey, "FactoryService",
  3847         -                            serviceId.ToString(VsIdFormat), whatIf, verbose);
         4243  +                            package.ServiceId.ToString(VsIdFormat), whatIf,
         4244  +                            verbose);
  3848   4245   
  3849   4246                           RegistryHelper.CreateSubKey(dataProviderKey,
  3850   4247                               "SupportedObjects\\DataConnectionUIControl",
  3851   4248                               whatIf, verbose);
  3852   4249   
  3853   4250                           RegistryHelper.CreateSubKey(dataProviderKey,
  3854   4251                               "SupportedObjects\\DataConnectionProperties",
................................................................................
  3873   4270           }
  3874   4271   
  3875   4272           ///////////////////////////////////////////////////////////////////////
  3876   4273   
  3877   4274           private static bool RemoveVsDataProvider(
  3878   4275               RegistryKey rootKey,
  3879   4276               Version vsVersion,
  3880         -            Guid dataProviderId,
         4277  +            Package package,
  3881   4278               bool whatIf,
  3882   4279               bool verbose,
  3883   4280               ref string error
  3884   4281               )
  3885   4282           {
         4283  +            if (vsVersion == null)
         4284  +            {
         4285  +                error = "invalid VS version";
         4286  +                return false;
         4287  +            }
         4288  +
  3886   4289               string keyName = GetVsKeyName(vsVersion);
  3887   4290   
  3888   4291               using (MockRegistryKey key = RegistryHelper.OpenSubKey(
  3889   4292                       rootKey, keyName, false, whatIf, verbose))
  3890   4293               {
  3891   4294                   if (key == null)
  3892   4295                   {
................................................................................
  3906   4309                               "could not open registry key: {0}\\DataProviders",
  3907   4310                               key);
  3908   4311   
  3909   4312                           return false;
  3910   4313                       }
  3911   4314   
  3912   4315                       RegistryHelper.DeleteSubKeyTree(
  3913         -                        subKey, dataProviderId.ToString(VsIdFormat), whatIf,
  3914         -                        verbose);
         4316  +                        subKey, package.DataProviderId.ToString(VsIdFormat),
         4317  +                        whatIf, verbose);
  3915   4318                   }
  3916   4319               }
  3917   4320   
  3918   4321               return true;
  3919   4322           }
  3920   4323   
  3921   4324           ///////////////////////////////////////////////////////////////////////
  3922   4325   
  3923   4326           private static bool ProcessVsDataProvider(
  3924   4327               RegistryKey rootKey,
  3925   4328               Version vsVersion,
  3926         -            Guid packageId, /* NOT USED */
  3927         -            Guid serviceId,
  3928         -            Guid dataSourceId, /* NOT USED */
  3929         -            Guid dataProviderId,
         4329  +            Package package,
  3930   4330               object clientData,
  3931   4331               bool whatIf,
  3932   4332               bool verbose,
  3933   4333               ref string error
  3934   4334               )
  3935   4335           {
  3936   4336               AnyPair<string, bool> pair = clientData as AnyPair<string, bool>;
................................................................................
  3940   4340                   error = "invalid VS callback data";
  3941   4341                   return false;
  3942   4342               }
  3943   4343   
  3944   4344               if (pair.Y)
  3945   4345               {
  3946   4346                   return AddVsDataProvider(
  3947         -                    rootKey, vsVersion, serviceId, dataProviderId, pair.X,
         4347  +                    rootKey, vsVersion, package, pair.X,
  3948   4348                       whatIf, verbose, ref error);
  3949   4349               }
  3950   4350               else
  3951   4351               {
  3952   4352                   return RemoveVsDataProvider(
  3953         -                    rootKey, vsVersion, dataProviderId, whatIf, verbose,
  3954         -                    ref error);
         4353  +                    rootKey, vsVersion, package, whatIf,
         4354  +                    verbose, ref error);
  3955   4355               }
  3956   4356           }
  3957   4357           #endregion
  3958   4358   
  3959   4359           ///////////////////////////////////////////////////////////////////////
  3960   4360   
  3961   4361           #region Visual Studio Package Handling
         4362  +        private static void InitializeVsPackage(
         4363  +            ref Package package
         4364  +            )
         4365  +        {
         4366  +            if (package == null)
         4367  +            {
         4368  +                package = new Package();
         4369  +
         4370  +                package.AdoNetTechnologyId = new Guid(
         4371  +                    "77AB9A9D-78B9-4BA7-91AC-873F5338F1D2");
         4372  +
         4373  +                package.PackageId = new Guid(
         4374  +                    "DCBE6C8D-0E57-4099-A183-98FF74C64D9C");
         4375  +
         4376  +                package.ServiceId = new Guid(
         4377  +                    "DCBE6C8D-0E57-4099-A183-98FF74C64D9D");
         4378  +
         4379  +                package.DataSourceId = new Guid(
         4380  +                    "0EBAAB6E-CA80-4B4A-8DDF-CBE6BF058C71");
         4381  +
         4382  +                package.DataProviderId = new Guid(
         4383  +                    "0EBAAB6E-CA80-4B4A-8DDF-CBE6BF058C70");
         4384  +            }
         4385  +        }
         4386  +
         4387  +        ///////////////////////////////////////////////////////////////////////
         4388  +
  3962   4389           private static bool AddVsPackage(
  3963   4390               RegistryKey rootKey,
  3964   4391               Version vsVersion,
  3965         -            Guid packageId,
  3966         -            Guid serviceId,
         4392  +            Package package,
  3967   4393               string fileName,
  3968   4394               bool whatIf,
  3969   4395               bool verbose,
  3970   4396               ref string error
  3971   4397               )
  3972   4398           {
         4399  +            if (vsVersion == null)
         4400  +            {
         4401  +                error = "invalid VS version";
         4402  +                return false;
         4403  +            }
         4404  +
         4405  +            if (package == null)
         4406  +            {
         4407  +                error = "invalid VS package";
         4408  +                return false;
         4409  +            }
         4410  +
  3973   4411               string keyName = GetVsKeyName(vsVersion);
  3974   4412   
  3975   4413               using (MockRegistryKey key = RegistryHelper.OpenSubKey(
  3976   4414                       rootKey, keyName, false, whatIf, verbose))
  3977   4415               {
  3978   4416                   if (key == null)
  3979   4417                   {
................................................................................
  3993   4431                               "could not open registry key: {0}\\Packages",
  3994   4432                               key);
  3995   4433   
  3996   4434                           return false;
  3997   4435                       }
  3998   4436   
  3999   4437                       using (MockRegistryKey packageKey = RegistryHelper.CreateSubKey(
  4000         -                            subKey, packageId.ToString(VsIdFormat), whatIf,
         4438  +                            subKey, package.PackageId.ToString(VsIdFormat), whatIf,
  4001   4439                               verbose))
  4002   4440                       {
  4003   4441                           if (packageKey == null)
  4004   4442                           {
  4005   4443                               error = String.Format(
  4006   4444                                   "could not create registry key: {0}\\{1}",
  4007         -                                key, packageId.ToString(VsIdFormat));
         4445  +                                key, package.PackageId.ToString(VsIdFormat));
  4008   4446   
  4009   4447                               return false;
  4010   4448                           }
  4011   4449   
  4012   4450                           RegistryHelper.SetValue(packageKey, null, String.Format(
  4013   4451                               "{0} Designer Package", ProjectName), whatIf,
  4014   4452                               verbose);
................................................................................
  4067   4505                               "could not open registry key: {0}\\Menus",
  4068   4506                               key);
  4069   4507   
  4070   4508                           return false;
  4071   4509                       }
  4072   4510   
  4073   4511                       RegistryHelper.SetValue(
  4074         -                        subKey, packageId.ToString(VsIdFormat), ", 1000, 3",
  4075         -                        whatIf, verbose);
         4512  +                        subKey, package.PackageId.ToString(VsIdFormat),
         4513  +                        ", 1000, 3", whatIf, verbose);
  4076   4514                   }
  4077   4515   
  4078   4516                   using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
  4079   4517                           key, "Services", true, whatIf, verbose))
  4080   4518                   {
  4081   4519                       if (subKey == null)
  4082   4520                       {
................................................................................
  4084   4522                               "could not open registry key: {0}\\Services",
  4085   4523                               key);
  4086   4524   
  4087   4525                           return false;
  4088   4526                       }
  4089   4527   
  4090   4528                       using (MockRegistryKey serviceKey = RegistryHelper.CreateSubKey(
  4091         -                            subKey, serviceId.ToString(VsIdFormat), whatIf,
         4529  +                            subKey, package.ServiceId.ToString(VsIdFormat), whatIf,
  4092   4530                               verbose))
  4093   4531                       {
  4094   4532                           if (serviceKey == null)
  4095   4533                           {
  4096   4534                               error = String.Format(
  4097   4535                                   "could not create registry key: {0}\\{1}",
  4098         -                                key, serviceId.ToString(VsIdFormat));
         4536  +                                key, package.ServiceId.ToString(VsIdFormat));
  4099   4537   
  4100   4538                               return false;
  4101   4539                           }
  4102   4540   
  4103   4541                           RegistryHelper.SetValue(serviceKey, null,
  4104         -                            packageId.ToString(VsIdFormat), whatIf, verbose);
         4542  +                            package.PackageId.ToString(VsIdFormat), whatIf,
         4543  +                            verbose);
  4105   4544   
  4106   4545                           RegistryHelper.SetValue(serviceKey, "Name",
  4107   4546                               String.Format("{0} Designer Service", ProjectName),
  4108   4547                               whatIf, verbose);
  4109   4548                       }
  4110   4549                   }
  4111   4550               }
................................................................................
  4114   4553           }
  4115   4554   
  4116   4555           ///////////////////////////////////////////////////////////////////////
  4117   4556   
  4118   4557           private static bool RemoveVsPackage(
  4119   4558               RegistryKey rootKey,
  4120   4559               Version vsVersion,
  4121         -            Guid packageId,
  4122         -            Guid serviceId,
         4560  +            Package package,
  4123   4561               bool whatIf,
  4124   4562               bool verbose,
  4125   4563               ref string error
  4126   4564               )
  4127   4565           {
         4566  +            if (vsVersion == null)
         4567  +            {
         4568  +                error = "invalid VS version";
         4569  +                return false;
         4570  +            }
         4571  +
         4572  +            if (package == null)
         4573  +            {
         4574  +                error = "invalid VS package";
         4575  +                return false;
         4576  +            }
         4577  +
  4128   4578               string keyName = GetVsKeyName(vsVersion);
  4129   4579   
  4130   4580               using (MockRegistryKey key = RegistryHelper.OpenSubKey(
  4131   4581                       rootKey, keyName, false, whatIf, verbose))
  4132   4582               {
  4133   4583                   if (key == null)
  4134   4584                   {
................................................................................
  4148   4598                               "could not open registry key: {0}\\Packages",
  4149   4599                               key);
  4150   4600   
  4151   4601                           return false;
  4152   4602                       }
  4153   4603   
  4154   4604                       RegistryHelper.DeleteSubKeyTree(
  4155         -                        key, packageId.ToString(VsIdFormat), whatIf, verbose);
         4605  +                        key, package.PackageId.ToString(VsIdFormat), whatIf,
         4606  +                        verbose);
  4156   4607                   }
  4157   4608   
  4158   4609                   using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
  4159   4610                           key, "Menus", true, whatIf, verbose))
  4160   4611                   {
  4161   4612                       if (subKey == null)
  4162   4613                       {
................................................................................
  4164   4615                               "could not open registry key: {0}\\Menus",
  4165   4616                               key);
  4166   4617   
  4167   4618                           return false;
  4168   4619                       }
  4169   4620   
  4170   4621                       RegistryHelper.DeleteValue(
  4171         -                        subKey, packageId.ToString(VsIdFormat), whatIf,
         4622  +                        subKey, package.PackageId.ToString(VsIdFormat), whatIf,
  4172   4623                           verbose);
  4173   4624                   }
  4174   4625   
  4175   4626                   using (MockRegistryKey subKey = RegistryHelper.OpenSubKey(
  4176   4627                           key, "Services", true, whatIf, verbose))
  4177   4628                   {
  4178   4629                       if (subKey == null)
................................................................................
  4181   4632                               "could not open registry key: {0}\\Services",
  4182   4633                               key);
  4183   4634   
  4184   4635                           return false;
  4185   4636                       }
  4186   4637   
  4187   4638                       RegistryHelper.DeleteSubKeyTree(
  4188         -                        subKey, serviceId.ToString(VsIdFormat), whatIf,
         4639  +                        subKey, package.ServiceId.ToString(VsIdFormat), whatIf,
  4189   4640                           verbose);
  4190   4641                   }
  4191   4642               }
  4192   4643   
  4193   4644               return true;
  4194   4645           }
  4195   4646   
  4196   4647           ///////////////////////////////////////////////////////////////////////
  4197   4648   
  4198   4649           private static bool ProcessVsPackage(
  4199   4650               RegistryKey rootKey,
  4200   4651               Version vsVersion,
  4201         -            Guid packageId,
  4202         -            Guid serviceId,
  4203         -            Guid dataSourceId,
  4204         -            Guid dataProviderId,
         4652  +            Package package,
  4205   4653               object clientData,
  4206   4654               bool whatIf,
  4207   4655               bool verbose,
  4208   4656               ref string error
  4209   4657               )
  4210   4658           {
  4211   4659               AnyPair<string, bool> pair = clientData as AnyPair<string, bool>;
................................................................................
  4215   4663                   error = "invalid VS callback data";
  4216   4664                   return false;
  4217   4665               }
  4218   4666   
  4219   4667               if (pair.Y)
  4220   4668               {
  4221   4669                   return AddVsPackage(
  4222         -                    rootKey, vsVersion, packageId, serviceId, pair.X, whatIf,
         4670  +                    rootKey, vsVersion, package, pair.X, whatIf,
  4223   4671                       verbose, ref error);
  4224   4672               }
  4225   4673               else
  4226   4674               {
  4227   4675                   return RemoveVsPackage(
  4228         -                    rootKey, vsVersion, packageId, serviceId, whatIf, verbose,
         4676  +                    rootKey, vsVersion, package, whatIf, verbose,
  4229   4677                       ref error);
  4230   4678               }
  4231   4679           }
  4232   4680           #endregion
  4233   4681           #endregion
  4234   4682   
  4235   4683           ///////////////////////////////////////////////////////////////////////
  4236   4684   
  4237   4685           #region Application Entry Point
  4238         -        private static int Main(string[] args)
         4686  +        private static int Main(
         4687  +            string[] args
         4688  +            )
  4239   4689           {
  4240   4690               Configuration configuration = null;
  4241   4691               string error = null;
  4242   4692   
  4243   4693               ///////////////////////////////////////////////////////////////////
  4244   4694   
  4245   4695               #region Command Line Processing
  4246   4696               if (!Configuration.FromArgs(
  4247   4697                       args, true, ref configuration, ref error) ||
  4248   4698                   !Configuration.Process(
  4249         -                    args, configuration, true, ref error))
         4699  +                    args, configuration, true, ref error) ||
         4700  +                !Configuration.CheckRuntimeVersion(
         4701  +                    configuration, true, ref error))
  4250   4702               {
  4251   4703                   TraceOps.ShowMessage(
  4252   4704                       TracePriority.Highest, traceCallback, thisAssembly,
  4253   4705                       error, traceCategory, MessageBoxButtons.OK,
  4254   4706                       MessageBoxIcon.Error);
  4255   4707   
  4256         -                return 1;
         4708  +                return 1; /* FAILURE */
  4257   4709               }
         4710  +            #endregion
         4711  +
         4712  +            ///////////////////////////////////////////////////////////////////
         4713  +
         4714  +            #region .NET Framework / Visual Studio Data
         4715  +            Package package = null;
         4716  +            FrameworkList frameworkList = null;
         4717  +            VsList vsList = null;
  4258   4718   
  4259   4719               ///////////////////////////////////////////////////////////////////
  4260   4720   
  4261         -            InitializeAllFrameworks(configuration);
  4262         -            InitializeAllVsVersions(configuration);
         4721  +            InitializeVsPackage(ref package);
         4722  +            InitializeFrameworkList(configuration, ref frameworkList);
         4723  +            InitializeVsList(configuration, ref vsList);
  4263   4724               #endregion
  4264   4725   
  4265   4726               ///////////////////////////////////////////////////////////////////
  4266   4727   
  4267   4728               AssemblyName assemblyName = AssemblyName.GetAssemblyName(
  4268   4729                   configuration.CoreFileName); /* throw */
  4269   4730   
................................................................................
  4325   4786               #endregion
  4326   4787   
  4327   4788               ///////////////////////////////////////////////////////////////////
  4328   4789   
  4329   4790               #region .NET AssemblyFolders
  4330   4791               if (configuration.HasFlags(InstallFlags.AssemblyFolders, true))
  4331   4792               {
  4332         -                if (!ForEachFrameworkRegistry(ProcessAssemblyFolders,
         4793  +                if (!ForEachFrameworkRegistry(
         4794  +                        frameworkList, ProcessAssemblyFolders,
  4333   4795                           directoryPair, configuration.WhatIf,
  4334   4796                           configuration.Verbose, ref error))
  4335   4797                   {
  4336   4798                       TraceOps.ShowMessage(
  4337         -                        TracePriority.Highest, traceCallback, null,
         4799  +                        TracePriority.Highest, traceCallback, thisAssembly,
  4338   4800                           error, traceCategory, MessageBoxButtons.OK,
  4339   4801                           MessageBoxIcon.Error);
  4340   4802   
  4341         -                    return 1;
         4803  +                    return 1; /* FAILURE */
  4342   4804                   }
  4343   4805               }
  4344   4806               #endregion
  4345   4807   
  4346   4808               ///////////////////////////////////////////////////////////////////
  4347   4809   
  4348   4810               #region .NET DbProviderFactory
  4349   4811               if (configuration.HasFlags(InstallFlags.DbProviderFactory, true))
  4350   4812               {
  4351   4813                   bool saved = false;
  4352   4814   
  4353         -                if (!ForEachFrameworkConfig(ProcessDbProviderFactory,
         4815  +                if (!ForEachFrameworkConfig(
         4816  +                        frameworkList, ProcessDbProviderFactory,
  4354   4817                           InvariantName, ProviderName, Description,
  4355   4818                           FactoryTypeName, assemblyName, directoryPair,
  4356   4819                           configuration.WhatIf, configuration.Verbose,
  4357   4820                           ref saved, ref error))
  4358   4821                   {
  4359   4822                       TraceOps.ShowMessage(
  4360         -                        TracePriority.Highest, traceCallback, null,
         4823  +                        TracePriority.Highest, traceCallback, thisAssembly,
  4361   4824                           error, traceCategory, MessageBoxButtons.OK,
  4362   4825                           MessageBoxIcon.Error);
  4363   4826   
  4364         -                    return 1;
         4827  +                    return 1; /* FAILURE */
  4365   4828                   }
  4366   4829               }
  4367   4830               #endregion
  4368   4831   
  4369   4832               ///////////////////////////////////////////////////////////////////
  4370   4833   
  4371   4834               #region VS Package
  4372   4835               if (configuration.HasFlags(InstallFlags.VsPackage, true))
  4373   4836               {
  4374         -                if (!ForEachVsVersionRegistry(ProcessVsPackage,
  4375         -                        (Guid)vsPackageId, (Guid)vsServiceId,
  4376         -                        (Guid)vsDataSourcesId, (Guid)vsDataProviderId,
  4377         -                        fileNamePair, configuration.WhatIf,
  4378         -                        configuration.Verbose, ref error))
         4837  +                if (!ForEachVsVersionRegistry(
         4838  +                        vsList, ProcessVsPackage, package, fileNamePair,
         4839  +                        configuration.WhatIf, configuration.Verbose,
         4840  +                        ref error))
  4379   4841                   {
  4380   4842                       TraceOps.ShowMessage(
  4381         -                        TracePriority.Highest, traceCallback, null,
         4843  +                        TracePriority.Highest, traceCallback, thisAssembly,
  4382   4844                           error, traceCategory, MessageBoxButtons.OK,
  4383   4845                           MessageBoxIcon.Error);
  4384   4846   
  4385         -                    return 1;
         4847  +                    return 1; /* FAILURE */
  4386   4848                   }
  4387   4849               }
  4388   4850               #endregion
  4389   4851   
  4390   4852               ///////////////////////////////////////////////////////////////////
  4391   4853   
  4392   4854               #region VS DataSource
  4393   4855               if (configuration.HasFlags(InstallFlags.VsDataSource, true))
  4394   4856               {
  4395         -                if (!ForEachVsVersionRegistry(ProcessVsDataSource,
  4396         -                        (Guid)vsPackageId, (Guid)vsServiceId,
  4397         -                        (Guid)vsDataSourcesId, (Guid)vsDataProviderId,
  4398         -                        fileNamePair, configuration.WhatIf,
  4399         -                        configuration.Verbose, ref error))
         4857  +                if (!ForEachVsVersionRegistry(
         4858  +                        vsList, ProcessVsDataSource, package, fileNamePair,
         4859  +                        configuration.WhatIf, configuration.Verbose,
         4860  +                        ref error))
  4400   4861                   {
  4401   4862                       TraceOps.ShowMessage(
  4402         -                        TracePriority.Highest, traceCallback, null,
         4863  +                        TracePriority.Highest, traceCallback, thisAssembly,
  4403   4864                           error, traceCategory, MessageBoxButtons.OK,
  4404   4865                           MessageBoxIcon.Error);
  4405   4866   
  4406         -                    return 1;
         4867  +                    return 1; /* FAILURE */
  4407   4868                   }
  4408   4869               }
  4409   4870               #endregion
  4410   4871   
  4411   4872               ///////////////////////////////////////////////////////////////////
  4412   4873   
  4413   4874               #region VS DataProvider
  4414   4875               if (configuration.HasFlags(InstallFlags.VsDataProvider, true))
  4415   4876               {
  4416         -                if (!ForEachVsVersionRegistry(ProcessVsDataProvider,
  4417         -                        (Guid)vsPackageId, (Guid)vsServiceId,
  4418         -                        (Guid)vsDataSourcesId, (Guid)vsDataProviderId,
  4419         -                        fileNamePair, configuration.WhatIf,
  4420         -                        configuration.Verbose, ref error))
         4877  +                if (!ForEachVsVersionRegistry(
         4878  +                        vsList, ProcessVsDataProvider, package, fileNamePair,
         4879  +                        configuration.WhatIf, configuration.Verbose,
         4880  +                        ref error))
  4421   4881                   {
  4422   4882                       TraceOps.ShowMessage(
  4423         -                        TracePriority.Highest, traceCallback, null,
         4883  +                        TracePriority.Highest, traceCallback, thisAssembly,
  4424   4884                           error, traceCategory, MessageBoxButtons.OK,
  4425   4885                           MessageBoxIcon.Error);
  4426   4886   
  4427         -                    return 1;
         4887  +                    return 1; /* FAILURE */
  4428   4888                   }
  4429   4889               }
  4430   4890               #endregion
  4431   4891   
  4432   4892               ///////////////////////////////////////////////////////////////////
  4433   4893   
         4894  +            #region Log Summary
  4434   4895               TraceOps.Trace(
  4435   4896                   TracePriority.Higher, traceCallback, String.Format(
  4436   4897                   "subKeysCreated = {0}, subKeysDeleted = {1}, " +
  4437   4898                   "keyValuesSet = {2}, keyValuesDeleted = {3}",
  4438   4899                   ForDisplay(RegistryHelper.SubKeysCreated),
  4439   4900                   ForDisplay(RegistryHelper.SubKeysDeleted),
  4440   4901                   ForDisplay(RegistryHelper.KeyValuesSet),
  4441   4902                   ForDisplay(RegistryHelper.KeyValuesDeleted)),
  4442   4903                   traceCategory);
         4904  +            #endregion
  4443   4905   
  4444   4906               ///////////////////////////////////////////////////////////////////
  4445   4907   
  4446         -            return 0;
         4908  +            return 0; /* SUCCESS */
  4447   4909           }
  4448   4910           #endregion
  4449   4911       }
  4450   4912       #endregion
  4451   4913   }