Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | 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). |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | VsInstallerWork |
Files: | files | file ages | folders |
SHA1: |
16872024deeef3febc7ec7d13139afea |
User & Date: | mistachkin 2012-01-02 12:14:14.597 |
Context
2012-01-03
| ||
04:48 | More refactoring, eliminate all static data pertaining to .NET Framework and/or Visual Studio versions, replacing them with the POD classes FrameworkList and VsList. check-in: 2398c28918 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 | |
Changes
Changes to tools/install/Installer.cs.
︙ | ︙ | |||
1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 | // do nothing. } } #endregion /////////////////////////////////////////////////////////////////////// #region Configuration Class private sealed class Configuration { #region Private Constants private const char Switch = '-'; private const char AltSwitch = '/'; | > > > > > > > > > > > > | 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 | // do nothing. } } #endregion /////////////////////////////////////////////////////////////////////// #region VersionListMap Class private sealed class VersionListMap : Dictionary<Version, VersionList> { public VersionListMap() { // do nothing. } } #endregion /////////////////////////////////////////////////////////////////////// #region Configuration Class private sealed class Configuration { #region Private Constants private const char Switch = '-'; private const char AltSwitch = '/'; |
︙ | ︙ | |||
2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 | // // NOTE: Show where we are running from and how we were // invoked. // string location = assembly.Location; TraceOps.Trace( TracePriority.Medium, traceCallback, String.Format( "Original command line is: {0}", Environment.CommandLine), traceCategory); if (!configuration.whatIf) { | > > > > > | 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 | // // NOTE: Show where we are running from and how we were // invoked. // string location = assembly.Location; TraceOps.Trace( TracePriority.Medium, traceCallback, String.Format( "Running from: {0}", ForDisplay(location)), traceCategory); TraceOps.Trace( TracePriority.Medium, traceCallback, String.Format( "Original command line is: {0}", Environment.CommandLine), traceCategory); if (!configuration.whatIf) { |
︙ | ︙ | |||
2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 | { TraceOps.Trace( TracePriority.Highest, traceCallback, e, traceCategory); error = "Failed to process configuration."; } return false; } #endregion /////////////////////////////////////////////////////////////////// | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 | { TraceOps.Trace( TracePriority.Highest, traceCallback, e, traceCategory); error = "Failed to process configuration."; } return false; } /////////////////////////////////////////////////////////////////// public static bool CheckImageRuntimeVersion( Configuration configuration, VersionListMap fromtoyou, VersionList versionList, bool strict, ref string error ) { try { if (configuration == null) { error = "Invalid configuration."; return false; } Assembly assembly = configuration.assembly; if (assembly == null) { error = "Invalid assembly."; return false; } // // NOTE: What version of the runtime was the core (primary) // assembly compiled against (e.g. "v2.0.50727" or // "v4.0.30319"). // string coreImageRuntimeVersion = GetImageRuntimeVersion( configuration.coreFileName); // // TODO: Restrict the configuration based on which image // runtime versions (which more-or-less correspond // to .NET Framework versions) are supported by the // versions of Visual Studio that are installed. // return true; } catch (Exception e) { TraceOps.Trace( TracePriority.Highest, traceCallback, e, traceCategory); error = "Failed to check image runtime version."; } return false; } #endregion /////////////////////////////////////////////////////////////////// |
︙ | ︙ | |||
2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 | private static VersionMap frameworkVersionMap; private static StringList platformNameList; /////////////////////////////////////////////////////////////////////// private static RegistryKey vsRootKey; private static VersionList vsVersionList; private static Guid? vsPackageId; private static Guid? vsServiceId; private static Guid? vsDataSourcesId; private static Guid? vsDataProviderId; private static Guid? vsAdoNetTechnologyId; #endregion | > | 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 | private static VersionMap frameworkVersionMap; private static StringList platformNameList; /////////////////////////////////////////////////////////////////////// private static RegistryKey vsRootKey; private static VersionList vsVersionList; private static VersionListMap vsFrameworkVersionMap; private static Guid? vsPackageId; private static Guid? vsServiceId; private static Guid? vsDataSourcesId; private static Guid? vsDataProviderId; private static Guid? vsAdoNetTechnologyId; #endregion |
︙ | ︙ | |||
2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 | return null; } #endregion /////////////////////////////////////////////////////////////////////// #region Per-Framework/Platform Handling private static void InitializeAllFrameworks( Configuration configuration ) { if (frameworkRootKey == null) frameworkRootKey = Registry.LocalMachine; | > > > > > > > > > > > > > > > > > > > | 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 | return null; } #endregion /////////////////////////////////////////////////////////////////////// #region Per-Framework/Platform Handling private static void ResetAllFrameworks() { frameworkRootKey = null; if (frameworkNameList != null) { frameworkNameList.Clear(); frameworkNameList = null; } if (frameworkVersionMap != null) { frameworkVersionMap.Clear(); frameworkVersionMap = null; } } /////////////////////////////////////////////////////////////////////// private static void InitializeAllFrameworks( Configuration configuration ) { if (frameworkRootKey == null) frameworkRootKey = Registry.LocalMachine; |
︙ | ︙ | |||
2762 2763 2764 2765 2766 2767 2768 | desktopVersionList.Add(new Version(4, 0, 30319)); frameworkVersionMap.Add(".NETFramework", desktopVersionList); } if ((configuration == null) || !configuration.NoCompact) { | | | | 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 | desktopVersionList.Add(new Version(4, 0, 30319)); frameworkVersionMap.Add(".NETFramework", desktopVersionList); } if ((configuration == null) || !configuration.NoCompact) { frameworkVersionMap.Add(".NETCompactFramework", new VersionList(new Version[] { new Version(2, 0, 0, 0), new Version(3, 5, 0, 0) })); } if (platformNameList == null) { platformNameList = new StringList(); |
︙ | ︙ | |||
2808 2809 2810 2811 2812 2813 2814 | using (MockRegistryKey key = RegistryHelper.OpenSubKey( rootKey, keyName, false, whatIf, verbose)) { if (key == null) return false; | | | 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 | using (MockRegistryKey key = RegistryHelper.OpenSubKey( rootKey, keyName, false, whatIf, verbose)) { if (key == null) return false; if (platformName != null) // NOTE: Skip non-desktop. return true; string directory = GetFrameworkDirectory( rootKey, frameworkVersion, whatIf, verbose); if (String.IsNullOrEmpty(directory)) return false; |
︙ | ︙ | |||
3117 3118 3119 3120 3121 3122 3123 | return true; } #endregion /////////////////////////////////////////////////////////////////////// #region Per-Visual Studio Version Handling | | < < | 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 | return true; } #endregion /////////////////////////////////////////////////////////////////////// #region Per-Visual Studio Version Handling private static void InitializeVsRootKeyAndIds() { if (vsRootKey == null) vsRootKey = Registry.LocalMachine; if (vsAdoNetTechnologyId == null) vsAdoNetTechnologyId = new Guid( "77AB9A9D-78B9-4BA7-91AC-873F5338F1D2"); |
︙ | ︙ | |||
3143 3144 3145 3146 3147 3148 3149 | if (vsDataSourcesId == null) vsDataSourcesId = new Guid( "0EBAAB6E-CA80-4B4A-8DDF-CBE6BF058C71"); if (vsDataProviderId == null) vsDataProviderId = new Guid( "0EBAAB6E-CA80-4B4A-8DDF-CBE6BF058C70"); | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 | if (vsDataSourcesId == null) vsDataSourcesId = new Guid( "0EBAAB6E-CA80-4B4A-8DDF-CBE6BF058C71"); if (vsDataProviderId == null) vsDataProviderId = new Guid( "0EBAAB6E-CA80-4B4A-8DDF-CBE6BF058C70"); } /////////////////////////////////////////////////////////////////////// private static void ResetVsFrameworkVersionMap() { if (vsFrameworkVersionMap != null) { vsFrameworkVersionMap.Clear(); vsFrameworkVersionMap = null; } } /////////////////////////////////////////////////////////////////////// private static void InitializeVsFrameworkVersionMap( Configuration configuration ) { if (vsFrameworkVersionMap == null) { vsFrameworkVersionMap = new VersionListMap(); // vsFrameworkVersionMap.Add(new Version(8, 0), // new VersionList(new Version[] { // new Version(2, 0, 50727) })); if ((configuration == null) || !configuration.NoVs2008) vsFrameworkVersionMap.Add(new Version(9, 0), new VersionList(new Version[] { new Version(2, 0, 50727) })); if ((configuration == null) || !configuration.NoVs2010) vsFrameworkVersionMap.Add(new Version(10, 0), new VersionList(new Version[] { new Version(2, 0, 50727), new Version(4, 0, 30319) })); } } /////////////////////////////////////////////////////////////////////// private static void ResetAllVsVersions() { if (vsVersionList != null) { vsVersionList.Clear(); vsVersionList = null; } } /////////////////////////////////////////////////////////////////////// private static void InitializeAllVsVersions( Configuration configuration ) { if (vsVersionList == null) { vsVersionList = new VersionList(); // vsVersionList.Add(new Version(8, 0)); // Visual Studio 2005 if ((configuration == null) || !configuration.NoVs2008) |
︙ | ︙ | |||
3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 | private static string GetVsKeyName( Version vsVersion ) { return String.Format("Software\\Microsoft\\VisualStudio\\{0}", vsVersion); } /////////////////////////////////////////////////////////////////////// #region Visual Studio Data Source Handling private static bool AddVsDataSource( RegistryKey rootKey, Version vsVersion, | > > > > > > > > > > > > > > > > > > > > > > > > > | 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 | private static string GetVsKeyName( Version vsVersion ) { return String.Format("Software\\Microsoft\\VisualStudio\\{0}", vsVersion); } /////////////////////////////////////////////////////////////////////// #region Visual Studio Version Handling private static bool AddVsVersion( RegistryKey rootKey, Version vsVersion, Guid packageId, Guid serviceId, Guid dataSourceId, Guid dataProviderId, object clientData, bool whatIf, bool verbose, ref string error ) { VersionList versionList = clientData as VersionList; if (versionList != null) versionList.Add(vsVersion); return true; } #endregion /////////////////////////////////////////////////////////////////////// #region Visual Studio Data Source Handling private static bool AddVsDataSource( RegistryKey rootKey, Version vsVersion, |
︙ | ︙ | |||
4231 4232 4233 4234 4235 4236 4237 | } #endregion #endregion /////////////////////////////////////////////////////////////////////// #region Application Entry Point | > > > > > > > > > > > > > > > > > > > > > > | > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 | } #endregion #endregion /////////////////////////////////////////////////////////////////////// #region Application Entry Point public static string GetImageRuntimeVersion( string fileName ) { try { Assembly assembly = Assembly.ReflectionOnlyLoadFrom(fileName); /* throw */ if (assembly != null) return assembly.ImageRuntimeVersion; } catch { // do nothing. } return null; } /////////////////////////////////////////////////////////////////////// private static int Main( string[] args ) { Configuration configuration = null; string error = null; /////////////////////////////////////////////////////////////////// #region Command Line Processing if (!Configuration.FromArgs( args, true, ref configuration, ref error) || !Configuration.Process( args, configuration, true, ref error)) { TraceOps.ShowMessage( TracePriority.Highest, traceCallback, thisAssembly, error, traceCategory, MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; /* FAILURE */ } #endregion /////////////////////////////////////////////////////////////////// #region Check Installed VS Versions InitializeVsRootKeyAndIds(); InitializeAllFrameworks(null); InitializeAllVsVersions(null); VersionList installedVsVersions = new VersionList(); if (configuration.HasFlags(InstallFlags.All, /* any */ false)) { if (!ForEachVsVersionRegistry(AddVsVersion, Guid.Empty, Guid.Empty, Guid.Empty, Guid.Empty, installedVsVersions, configuration.WhatIf, configuration.Verbose, ref error)) { TraceOps.ShowMessage( TracePriority.Highest, traceCallback, null, error, traceCategory, MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; /* FAILURE */ } } InitializeVsFrameworkVersionMap(configuration); /////////////////////////////////////////////////////////////////// if (!Configuration.CheckImageRuntimeVersion( configuration, vsFrameworkVersionMap, installedVsVersions, true, ref error)) { TraceOps.ShowMessage( TracePriority.Highest, traceCallback, thisAssembly, error, traceCategory, MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; /* FAILURE */ } /////////////////////////////////////////////////////////////////// InitializeAllFrameworks(configuration); InitializeAllVsVersions(configuration); #endregion |
︙ | ︙ | |||
4334 4335 4336 4337 4338 4339 4340 | configuration.Verbose, ref error)) { TraceOps.ShowMessage( TracePriority.Highest, traceCallback, null, error, traceCategory, MessageBoxButtons.OK, MessageBoxIcon.Error); | | | 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 | configuration.Verbose, ref error)) { TraceOps.ShowMessage( TracePriority.Highest, traceCallback, null, error, traceCategory, MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; /* FAILURE */ } } #endregion /////////////////////////////////////////////////////////////////// #region .NET DbProviderFactory |
︙ | ︙ | |||
4357 4358 4359 4360 4361 4362 4363 | ref saved, ref error)) { TraceOps.ShowMessage( TracePriority.Highest, traceCallback, null, error, traceCategory, MessageBoxButtons.OK, MessageBoxIcon.Error); | | | | | > > | | 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 | ref saved, ref error)) { TraceOps.ShowMessage( TracePriority.Highest, traceCallback, null, error, traceCategory, MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; /* FAILURE */ } } #endregion /////////////////////////////////////////////////////////////////// #region VS Package if (configuration.HasFlags(InstallFlags.VsPackage, true)) { if (!ForEachVsVersionRegistry(ProcessVsPackage, (Guid)vsPackageId, (Guid)vsServiceId, (Guid)vsDataSourcesId, (Guid)vsDataProviderId, fileNamePair, configuration.WhatIf, configuration.Verbose, ref error)) { TraceOps.ShowMessage( TracePriority.Highest, traceCallback, null, error, traceCategory, MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; /* FAILURE */ } } #endregion /////////////////////////////////////////////////////////////////// #region VS DataSource if (configuration.HasFlags(InstallFlags.VsDataSource, true)) { if (!ForEachVsVersionRegistry(ProcessVsDataSource, (Guid)vsPackageId, (Guid)vsServiceId, (Guid)vsDataSourcesId, (Guid)vsDataProviderId, fileNamePair, configuration.WhatIf, configuration.Verbose, ref error)) { TraceOps.ShowMessage( TracePriority.Highest, traceCallback, null, error, traceCategory, MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; /* FAILURE */ } } #endregion /////////////////////////////////////////////////////////////////// #region VS DataProvider if (configuration.HasFlags(InstallFlags.VsDataProvider, true)) { if (!ForEachVsVersionRegistry(ProcessVsDataProvider, (Guid)vsPackageId, (Guid)vsServiceId, (Guid)vsDataSourcesId, (Guid)vsDataProviderId, fileNamePair, configuration.WhatIf, configuration.Verbose, ref error)) { TraceOps.ShowMessage( TracePriority.Highest, traceCallback, null, error, traceCategory, MessageBoxButtons.OK, MessageBoxIcon.Error); return 1; /* FAILURE */ } } #endregion /////////////////////////////////////////////////////////////////// #region Log Summary TraceOps.Trace( TracePriority.Higher, traceCallback, String.Format( "subKeysCreated = {0}, subKeysDeleted = {1}, " + "keyValuesSet = {2}, keyValuesDeleted = {3}", ForDisplay(RegistryHelper.SubKeysCreated), ForDisplay(RegistryHelper.SubKeysDeleted), ForDisplay(RegistryHelper.KeyValuesSet), ForDisplay(RegistryHelper.KeyValuesDeleted)), traceCategory); #endregion /////////////////////////////////////////////////////////////////// return 0; /* SUCCESS */ } #endregion } #endregion } |