3

I'm trying to stop my fields being ordered alphabetically when running a clean code up across my solution, I have sort of got an answer for this question but this answer doesn't exactly work.

When going to the file layout section of ReSharper, many suggestions are to change the "sort by" box to something else when selection 'Fields' in the menu.

The issue with this is I don't have a drop down at all, I don't have anything I can select other than an empty white box that I can't really do anything with. I've tried researching this on google but it seems nobody knows why this happens or how to resolve the issue.

Here is an image of my current state.

https://i.imgur.com/qpds2PY.png

1
  • What version of ReSharper are you using? Jan 26, 2018 at 2:04

1 Answer 1

2

I don't know why the dropdown is not showing in the UI, but you should be able to do it by directly editing the XAML.

In order to do it:

  1. Open ReSharper/Options....
  2. Select Code Editing/C#/File Layout in the tree on the left hand side.
  3. Click on the XAML link on the top right corner of the file layout editor.
  4. Look for the <Entry DisplayName="Fields"> tag.
  5. Remove the <Entry.SortBy> child element from the entry:

    <Entry.SortBy>
        <Readonly />
        <Name />
    </Entry.SortBy>
    
  6. Click Save.

After this the Cleanup Code command won't affect the order of the fields.

Update (2018-02-01)

It seems the feature you're looking for is now available again in ReSharper 2017.3.2 which was released on 2018-01-31.

Quote from the changelog.

Sort by drop-down list and Switch to Constraint View icon come back to the File Layout page.

I tried it and it works now.

Sort by dropdown is back

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.