Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Can't get GetService method to work

$
0
0
I've got a wizard that I've created as part of an extension. In this wizard I have a function that will log any errors that I might catch along the way. Using the documentation for the ActivityLog here's the function I created:

private void LogError(string message)
        {
            IVsActivityLog _log = GetService(typeof(SVsActivityLog)) as IVsActivityLog;

            _log.LogEntry(
            (UInt32)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR,
            this.ToString(),
            string.Format(CultureInfo.CurrentCulture, "{0}", message));
        }
The documentation says that this should be added to the initialize method of a VSPackage. The issue I'm running in to is it's saying I'm missing a Using directive, but from what I've found the GetService method is in the System namespace. Am I missing something that's preventing me from using this method?

Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>