예제 #1
0
        // Normally unused. It doesn't hurt to offer a manual registration option though.
        // (this is not fully tested)
        public static void Main(string[] args)
        {
            var rct = new RegisterCustomTool();

            // http://blogs.msdn.com/b/aaronmar/archive/2009/11/06/all-your-regkeys-are-belong-to-us.aspx
            // http://blogs.msdn.com/b/dsvst/archive/2010/03/01/dissecting-vs-2010-package-registration.aspx
            List <string> hives = new List <string> {
                "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\12.0\\Generators",
                "SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Generators",
                "SOFTWARE\\Wow6432Node\\Microsoft\\VCSExpress\\12.0\\Generators",
                "SOFTWARE\\Microsoft\\VCSExpress\\12.0\\Generators",
                "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\11.0\\Generators",
                "SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Generators",
                "SOFTWARE\\Wow6432Node\\Microsoft\\VCSExpress\\11.0\\Generators",
                "SOFTWARE\\Microsoft\\VCSExpress\\11.0\\Generators",
                "SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\10.0\\Generators",
                "SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Generators",
                "SOFTWARE\\Wow6432Node\\Microsoft\\VCSExpress\\10.0\\Generators",
                "SOFTWARE\\Microsoft\\VCSExpress\\10.0\\Generators",
            };

            if (args.Length > 0 && args[0].StartsWith("SOFTWARE\\"))
            {
                hives.Clear();
                hives.Add(args[0]);
            }
            bool success = false;

            foreach (string hive in hives)
            {
                var key = Registry.LocalMachine.OpenSubKey(hive, true);
                if (key != null)
                {
                    success = true;
                    Console.WriteLine("Installing VS custom tool in registry: {0}", key);
                    rct._root = key;
                    rct.Initialize();
                }
            }
            if (!success)
            {
                Console.WriteLine("Visual Studio registry hive not found!");
            }

            Console.WriteLine("Note: this tool must also be registered with regasm.exe /codebase");
        }
예제 #2
0
		// Normally unused. It doesn't hurt to offer a manual registration option though.
		// (this is not fully tested)
		public static void Main(string[] args)
		{
			var rct = new RegisterCustomTool();

			// http://blogs.msdn.com/b/aaronmar/archive/2009/11/06/all-your-regkeys-are-belong-to-us.aspx
			// http://blogs.msdn.com/b/dsvst/archive/2010/03/01/dissecting-vs-2010-package-registration.aspx
			List<string> hives = new List<string> {
				"SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\12.0\\Generators",
				             "SOFTWARE\\Microsoft\\VisualStudio\\12.0\\Generators",
				"SOFTWARE\\Wow6432Node\\Microsoft\\VCSExpress\\12.0\\Generators",
				             "SOFTWARE\\Microsoft\\VCSExpress\\12.0\\Generators",
				"SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\11.0\\Generators",
				             "SOFTWARE\\Microsoft\\VisualStudio\\11.0\\Generators",
				"SOFTWARE\\Wow6432Node\\Microsoft\\VCSExpress\\11.0\\Generators", 
				             "SOFTWARE\\Microsoft\\VCSExpress\\11.0\\Generators", 
				"SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\10.0\\Generators",
				             "SOFTWARE\\Microsoft\\VisualStudio\\10.0\\Generators",
				"SOFTWARE\\Wow6432Node\\Microsoft\\VCSExpress\\10.0\\Generators",
				             "SOFTWARE\\Microsoft\\VCSExpress\\10.0\\Generators",
			};
			if (args.Length > 0 && args[0].StartsWith("SOFTWARE\\")) {
				hives.Clear();
				hives.Add(args[0]);
			}
			bool success = false;
			foreach (string hive in hives) {
				var key = Registry.LocalMachine.OpenSubKey(hive, true);
				if (key != null) {
					success = true;
					Console.WriteLine("Installing VS custom tool in registry: {0}", key);
					rct._root = key;
					rct.Initialize();
				}
			}
			if (!success)
				Console.WriteLine("Visual Studio registry hive not found!");

			Console.WriteLine("Note: this tool must also be registered with regasm.exe /codebase");
		}