Visual Studio removes line break on start

2020-02-17 07:43发布

问题:

I have the problem that Visual Studio (or maybe Resharper?) removes line breaks when I try to start my application. This happens in a way that when I press F5 or click on the run button with the mouse that a line break at the line where the cursor was the last time will be removed which is extremely annoying.

I have not tried so many things yet because I really don't know where to start. I never experienced this problem before and was always working with the same setup:

  • Visual Studio 2010
  • Resharper 6.1.1

Other plugins I use but which were installed after the problem (so I think they should not be related to the problem):

  • AnkhSvn
  • TeamCity

Example:

Before:

public void test(){
  int x = 5;
}

After running the solution:

public void test(){
  int x = 5;}

Edit: This issue seems to be related to Resharper - so hopefully they will be able to fix this issue as I never had this with any previous versions. (http://devnet.jetbrains.net/message/5456038#5456038).

回答1:

This is a problem with Dexexpress Dim@ster patch. If you delete licenses.licx and compile in the source code. Not happend. The problem is when you open a form and licenses.licx is created again. Is you uninstall the patch this dissapear. But I dont understand why deactivating Resharper the problem gone too. But without patch and resharper + devexpress trial working fine.

The problem is the patch.



回答2:

I'd do this before reinstalling:

  1. Uninstall All plugins
  2. Type devenv.exe /resetsettings

Now try and use your code as described without plugins. Slowly add back your plugins if its ok and check after each is installed if the problem manifests itself. if not it was some setting in one and its now gone, if it comes back after one is installed you have a good thing to look at.

Just blatting the environment means you'll never find out whats causing it, which would annoy me :)



回答3:

Have a look at ReSharper's Braces-settings: http://www.jetbrains.com/resharper/features/code_formatting.html#Code_Style_Configuration_and_Sharing (1st screenshot). Try changing those settings according to your needs.
If you're a member of a team, maybe someone else enabled sharing of "code style settings". See the previous link for that, 2nd screenshot. Does it also occur when you just build the project?



回答4:

In the build options try doing clean project, then open close the program. After this do a rebuild project. Also make sure the project is in debug mode for testing =)!



回答5:

Delete the settings resharper in solution. Helped me.



回答6:

I know that this question is a little bit old. But this may help anyone who encountered the same error with resharper and devexpress controls. I've tried all the above instructions, but the nothing works. BTW I'm using visual studio 2017 with resharper 2017.2.2 and devexpress 17.2.3

This what works for me.

Open build&run window in resharper. Click Resharper>Windows>Build&Run to open the the window then select "Enable 'Resharper Build'. Open any file in text editor and move the cursor at the end of any line of codes or on any empty line and try to build the project to see if it works.

Hope this will help.



回答7:

At this point I would suggest uninstalling and reinstalling VS. Then add ReSharper and any of your extensions one at a time.



回答8:

I had the same problem. I use this prebuilt-event script

break>$(ProjectDir)\Properties\licenses.licx

I have ReSharper 10.0.2, VS2013, DevExpress Components and VisualSVN.