How can I force Resharper to use the CLR type names for auto-generated code?

Open R# Options, go to C# Code Style. Or in more detail:

RESHARPER->Options

Code Editing->C#->Syntax Style

Build-in types

  • In locals, members and parameters, prefer - CLR type name
  • Members to qualify - CLR type name

Aside: You probably want to safe it Team Shared only as most public projects prefer keywords instead (and you don't want to accidentally annoy OSS contributors by suggesting a patch with that style).

older versions

Code Editing->C#->Code Style

Build-in type naming->When referencing build-in type, prefer using choose CLR type name

This feature requires R#9.1 or higher.

If you are bound to even older versions of ReSharper

There was an Extension for R#4.5-5.1 with exactly that purpose in mind. It's called Neovolve. Unfortunately this extension wasn't ported to any later R# versions.

VS 2015

Also for Visual Studio 2015 you may want to disable to prefer the intrinsic predefined types (which causes the symbols to be grayed out in the text editor) under Tools->Options Text Editor->C#->Code Style->Prefer intrinsic predefined type keyword*


Those guidelines are referring to public method names on your api, such as obj.ReadInt32() (perhaps in a serializer). In the body of a code (variables and parameters) it is less specified. Personally I prefer the aliases double, int etc - as:

  • better highlighting
  • less typing
  • avoids issues with non-keyword usage, i.e. if I have another method/type/property/etc called Int32 (stupid, but possible; where-as int always means global::System.Int32)
  • works even if you don't have using System;

Personally, I would not worry about this. R# is not doing anything wrong.

As an aside - note that there are a few examples of MS getting this wrong - one that leaps to mind is IDataReader/DbDataReader with GetFloat() (should be GetSingle()).