How to change default error search in Visual Studio 2015

后端 未结 4 1859
予麋鹿
予麋鹿 2021-01-08 01:20

While I was writing my code in Visual Studio 2015CTP I got error as below in ErrorList window:

Error CS0117 \'Console\' does not co

相关标签:
4条回答
  • 2021-01-08 01:26

    Another quick hack that I just made would be a browser script. I used Greasemonkey to generally redirect searches from Bing to Google. Because who the hell has ever chosen the former over the latter...

    If you have Greasemonkey installed or other places to use a userscript, you can use

    // @include     http://www.bing.com/search?q=*
    var rex = /\?q=(.+)/;
    window.location.href = ("http://www.google.com/#safe=off&q="+window.location.href.match(rex)[1]);
    

    to always redirect from Bing to Google.

    Not really a VS answer, but a work-around. And in my case, it seems just fine since I prefer Google.

    0 讨论(0)
  • 2021-01-08 01:28

    You can change it by setting up a hosts entry to 127.0.0.1 for bingdev.cloudapp.net and use the IIS URL Rewrite module to redirect your request to google.

    I went into more detail on my blog post here

    0 讨论(0)
  • 2021-01-08 01:38

    There’s no built-in support for switching the search engine used. It is, however, possible to create an extension that lets Google (and other) search engines be linked to instead, just as the Bing Developer Assistant extension did in previous releases of Visual Studio.

    I'd point you to the docs with info on how to create such an extension, but they're not published yet. They're on the list of docs to be published around the time Visual Studio 2015 is officially released.

    0 讨论(0)
  • 2021-01-08 01:39

    Simply redirecting the search provider probably won’t work. We generate a search string that is tailored to work with a specialized search engine on the Bing side. Passing that same search string to another search engine probably will give poor results.

    What you will need to do, instead, is define your own handler for the help event. This would extract relevant information from the error itself (such as error code, language, etc.) to create a generic search that would work with the provider of your choice. If this handler comes before the default handler, then you can handle the event and prevent the default (bing) search from executing.

    The interfaces your need to implement are:

    ITableControlEventProcessorProvider

    This is a MEF export and should have the following attributes:

    [Export(typeof(ITableControlEventProcessorProvider))]
    [DataSourceType(StandardTableDataSources.ErrorTableDataSourceString)]
    [DataSource(StandardTableDataSources.AnyDataSourceString)]
    [ManagerIdentifier(StandardTables.ErrorsTableString)]
    [Name("my custom event processor name")]
    [Order(Before=Priority.Default)]  
    

    ITableControlEventProcessor

    It is probably best to define a class that is derived from TableControlEventProcessorBase (which provides default/no-op implementations for all of the events) and then explicitly handle the PreprocessNavigateToHelp(ITableEntryHandle entry, TableEntryEventArgs e) event by:

    1. extracting the useful data from entry
    2. creating a generic search to the search provider of your choice
    3. opening an instance of the browser
    4. setting e.Handled to true (to prevent the other help handlers from executing).
    0 讨论(0)
提交回复
热议问题