コード例 #1
0
        private static void LogExceptionToActivityLog(Exception exception)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var vsActivityLog = VisualStudioServiceGateway.GetActivityLogService();

            vsActivityLog.LogEntry((uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, ProductConstants.ToolName, exception.ToString());
        }
コード例 #2
0
        public string FindByAssemblyName(string assemblyName)
        {
            var workspace = VisualStudioServiceGateway.GetWorkspace();

            var currentSolution = workspace.CurrentSolution;

            if (currentSolution == null)
            {
                throw new Exception("Cannot acquire CurrentSolution.");
            }

            var projectFilePath = currentSolution.Projects.FirstOrDefault(i => i.AssemblyName == assemblyName)?.FilePath;

            LogTraceMessage($"Project file path for '{assemblyName}' is '{projectFilePath}'.");

            return(projectFilePath);
        }