resharper

Resharper function to fix naming convention issues

馋奶兔 提交于 2019-12-04 02:34:52
A bunch of classes doesn't comply to our naming conventions for private variables. Resharper shows this as a warning, but wants me to fix all of them by hand. Is there some magic option to auto-fix these issues? 'Clean-up code' won't do anything with this. Same goes for converting properties with backing fields to automatic properties when possible: the hint is shown, but Resharper won't fix it automatically. In more recent versions of ReSharper, this is much easier, but the solution might not be obvious. It wasn't for me! Here are the steps: When an inconsistent naming is detected, ReSharper

How to prevent ReSharper from shortening namespaces when adding using directives?

落花浮王杯 提交于 2019-12-04 02:33:24
When I use ReSharper to add a using directive (using Alt+Enter) it removes "unnecessary" parts of the namespace. I prefer using the full namespace which is also the behavior of Visual Studio. Example: namespace MyCompany.MyTool.Data { // This is what ReSharper gives me: using Core; // This is what I want: using MyCompany.MyTool.Core; // ... } Which setting do I have to change in ReSharper 4.5 so it uses the full namespace? I don't have ReSharper 4.5 installed at the moment, but in 5.0 there's an option at the Namespace Imports pane called Prefer fully qualified using name at nested scope . It

Is there an option in ReSharper to not put an object initializer on multiple lines?

别说谁变了你拦得住时间么 提交于 2019-12-04 02:27:05
Every time I type an object initializer as a parameter, like this: SomeFunc(new { Id = id }) and type the semicolon afterwards, ReSharper formats what I just typed, as configured. However, I cannot find an option in ReSharper to make it not turn my code into this: SomeFunc(new { Id = id }); I did confirm it actually is ReSharper doing the formatting. If you want to keep ReSharper from formatting your object initializers (so you can decide how you want to format them yourself), I think a combination of these settings will do the job. Keep existing line breaks : [Checked] Place simple array,

Resharper always suggesting me to make const string instead of string

只愿长相守 提交于 2019-12-04 02:23:30
which one is good: string sQuery = "SELECT * FROM table"; or const string sQuery = "SELECT * FROM table"; And why resharper always suggest me to do this? The latter is better - it means that: This isn't an instance variable, so you don't end up with a redundant string reference in every instance that you create You won't be able to change the variable (which you presumably don't want to) There are some other effects of "const" in terms of access from other assemblies and versioning, but it looks like this is a private field so it shouldn't be an issue. You can mostly think of it as being:

How to reset the “Don't show this dialog again” settings for Visual Studio and ReSharper

自古美人都是妖i 提交于 2019-12-04 02:16:40
In a Visual Studio project (C#), I attempted to perform a rename of a namespace using the ReSharper shortcut ( Ctrl + R + R ). However, because I had branched some of the files that used the namespace from another location in the source control system, they had the readonly attribute set on them. Consequently, I received a dialog which contained "Sorry, apparently I can't post an image because I'm a new user": The file TestFile.cs which you attempted to edit, is readonly on disk. Would you like to make the file writeable or edit it anyway? Checkbox: Don't show this dialog again (Never allow in

ReSharper intellisense points to wrong function

一世执手 提交于 2019-12-04 02:11:25
问题 Once upon a time I fat fingered "Function" instead of "function" in a js file. Now my intellisense auto points to the ECMAScript's "Function" instead of a typical "function" declaration in javascript. How can I tell Resharper to ignore the "Function" result? 回答1: Clearing the caches would probably work - Resharper -> Options -> Environment -> General and click the Clear Caches button. 来源: https://stackoverflow.com/questions/21283306/resharper-intellisense-points-to-wrong-function

How to use bdd naming style with Resharper 4.5?

前提是你 提交于 2019-12-04 01:35:14
I just upgraded to Resharper 4.5 and now see that all my BDDish test methods are marked as not conforming to the naming standard. My naming convention is like this: public void Something_ShouldHaveThisResult() Resharper doesn't like the underscore in the method. Is there a way to turn this off, just for test methods? I have a normal naming convention for the rest of my code. On the menu: Resharper | Options -> Languages -> Common -> Naming Style: remove what ever naming style you want. They should have a "disable" feature, but they don't. How to change the ReSharper naming style for test

Resharper and TortoiseSVN

随声附和 提交于 2019-12-04 00:07:39
Is there any good way to deal with the class renaming refactor from Resharper when the file is under source control and TortoiseSVN is the client. I have am trying VisualSVN right now but I haven't had the need to rename anything recently. I don't want to change our repository just to try this out. Also not sure if this feature alone is worth the cost of VisualSVN. Update: I have uninstalled the trial of VisualSVN and tried AhknSVN. I seems to provided the same functionality so far. I know this my sound trivial but the indicators seem to be lacking some functionality, it seems like they don't

Resharper 7: MSTest not working - “Test wasn't run”

夙愿已清 提交于 2019-12-03 23:34:22
Since I upgraded to VS2012 and Resharper 7, my previously working MS Tests are not running anymore. The tests are run in an ASP.NET environment. I use the following Attributes: [TestMethod] [HostType("ASP.NET")] [AspNetDevelopmentServerHost("C:\\Projekte\\****\\Website", "/")] [UrlToTest("http://localhost:7924/")] Any idea how to fix this? As odd as it is, using VS2012, using Resharper 8.0, using NUnit, I was receiving this error because of an entry in my app.config file. I added an EntityFramework connection string and this behavior started. Removing the entire connection strings section

Stop ReSharper from Adding Annotations

时光毁灭记忆、已成空白 提交于 2019-12-03 23:21:10
I'm using ReSharper in my C# projects, and generally I love it. However, it keeps adding annotations to the code when I do certain refactoring actions. For example, it adds [NotNull] when I use the "Check parameter for null" context action: // Before context action public void Foo(object input) { } // After context action public void Foo([NotNull] object input) { if (input == null) { throw new ArgumentNullException("input"); } } Additionally, ReSharper then adds using JetBrains.Annotations to the file, even though I'm not referencing the JetBrains assembly where the attribute is defined. I