コード例 #1
0
        /// <summary>
        /// Loads the library with specific properties
        /// </summary>
        /// <param name="prop"></param>
        /// <returns></returns>
        public ILibrary load(InitializerProperties prop)
        {
            log.debug("Loading: '{0}' /'{1}'", prop.SolutionFile, prop.LibraryPath);

            ILoader loader = new Loader(
                                    new Provider.Settings()
                                    {
                                        DebugMode = log.IsDiagnostic,
                                        LibSettings = new LibSettings()
                                        {
                                            DebugMode = log.IsDiagnostic,
                                        },
                                    }
                                );

            try
            {
                ILibrary library = loader.load(prop.SolutionFile, prop.Properties, prop.LibraryPath);
                log.info("Library: loaded from '{0}' :: v{1} [{2}] API: v{3} /'{4}':{5}",
                                    library.Dllpath,
                                    library.Version.Number.ToString(),
                                    library.Version.BranchSha1,
                                    library.Version.Bridge.Number.ToString(2),
                                    library.Version.BranchName,
                                    library.Version.BranchRevCount);

                return library;
            }
            catch(DllNotFoundException ex)
            {
                log.info(ex.Message);
                log.info(new String('.', 80));
                log.info("How about:");

                log.info("");
                log.info("* Define path to library, for example: /l:CI.MSBuild.dll;lib=<path_to_vsSolutionBuildEvent.dll>");
                log.info("* Or install the vsSolutionBuildEvent as plugin for Visual Studio.");
                log.info("* Or manually place the 'vsSolutionBuildEvent.dll' with dependencies into: '{0}\\'", Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
                log.info("");

                log.info("See documentation for more details:");
                log.info("- http://vssbe.r-eg.net");
                log.info("- http://visualstudiogallery.msdn.microsoft.com/0d1dbfd7-ed8a-40af-ae39-281bfeca2334/");
                log.info("");

                log.info("Minimum requirements: vsSolutionBuildEvent.dll v{0}", loader.MinVersion.ToString());
                log.info(new String('.', 80));
            }
            catch(ReflectionTypeLoadException ex)
            {
                log.info(ex.ToString());
                log.info(new String('.', 80));

                foreach(FileNotFoundException le in ex.LoaderExceptions) {
                    log.info("{2} {0}{3} {0}{0}{4} {0}{1}",
                                        Environment.NewLine,
                                        new String('~', 80),
                                        le.FileName,
                                        le.Message,
                                        le.FusionLog);
                }
            }
            catch(Exception ex) {
                log.info("Error with loading: '{0}'", ex.ToString());
            }

            throw new LoggerException("Fatal error");
        }
コード例 #2
0
        /// <summary>Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            if(connectMode != ext_ConnectMode.ext_cm_CommandLine) {
                log.info("[Ignored] Allowed only Command-line mode /'{0}'", connectMode);
                return;
            }

            dte2    = (DTE2)application;
            addIn   = (AddIn)addInInst;

            ILoader loader = new Loader(
                                    new Provider.Settings()
                                    {
                                        DebugMode = log.IsDiagnostic,
                                        LibSettings = new LibSettings()
                                        {
                                            DebugMode = log.IsDiagnostic,
                                        },
                                    }
                                );

            init(loader, dte2, addIn);
        }