How does resharper recognise what files to include for its intellisense?

Go To StackoverFlow.com

10

It is a well known issue with Resharper that it fails to recognize generated C# files using Custom Tasks (making intellisense fail). Does anyone know how to fix this without adding the files to the project?

(BTW, including the generated files in the project or creating a separate assembly and other such flawed suggestions are totally out of the question).

  • Can we write a Resharper plugin for this? We have a fairly large number of developers that cannot use Resharper, so this would well be worth the effort.
  • Can we somehow add the obj/*.g.cs files to Resharpers non msbuild based csproj parser (lurking somewhere within Resharper)?
  • Is the method used by Resharper on how to resolve the list of .cs files to include documented somewhere?

As this issue is experienced and reported again and again for years, surely there must be someone who has cracked it by now?

2012-04-03 19:46
by Jack Wester
@Ritch - To find our what to compile is much trickier that naive parsing of the .csproj. MsBuild allows for background processing of stuff such as XAML generating invisible .cs files on the fly. You will not easily find that from the .csproj file alone. It involves visiting targets files and evaluating Custom Task assemblies - Jack Wester 2012-04-03 20:32
@Ritch - The process is well defined and used by many tools, but .csproj imports large quantites of advanced .targets that are non trivial. Microsoft uses MSbuild to resolve the code referenced in and by .csproj, and MsBuild is really more a functional language interpreter than a parser - Jack Wester 2012-04-03 20:37
@Ritch - No it does not. JetBrains have done hardcoded fixes for a few MS use cases and fails mot codegenerators including even quite a few MS ones. Common code generators that work ackording to the MS spec such as AntLr fails on Resharper while Microsoft intellisense work fine. This issue is well known and Jetbrains suggests different temporary fixes. We want to invest in a proper solution as our usecase affects a large number of developers - Jack Wester 2012-04-03 20:45
@Ritch - I see you have downvoted and removed your comments on how things work - Jack Wester 2012-04-03 21:18
I have downvoted nothing. This site is meant to be a professional forum that develops quality questions and answers for other developers. Correcting misconceptions about MSBuild and Resharper is part of that goal, but that comment spam wasn't helpful to any future reader. I stand by my remarks and my knowledge of MSBuild given my experience with developing custom tasks and a resharper plugin for a very large solution - Ritch Melton 2012-04-03 21:30


4

I found an extension for Resharper: ReSharper.ExternalCode.

Tip for Antlr: add obj\Debug in Resharper -> Code Inspection -> External Code and reload solution.

It's works for me.

2014-03-15 20:26
by Dem0n13
This one did not work for me, however R#\Options\Code Inspection\Settings\Edit Items to skip & adding the ANTLR project folder to the list works like a charm. VS Intellisense works, just R# ignores the files. Is the Code Inspection setting the only one that needed to be changed - milanio 2014-06-15 11:05
This helped me solve a little issue in Xamarin intellisense when using XAM - Karlo Medallo 2014-11-18 06:42
Ads