Posts Tagged ‘ReSharper 6’

ReSharper 6.1 Settings: DropBox and Company-wide

Tuesday, December 6th, 2011

This post is about ReSharper 6.1. For other features in ReSharper 6 (both 6.0 and 6.1), please see previous posts introducing ReSharper 6:

EAP Warning: This post is based on ReSharper 6.1 Early Access Program and some things such as screenshots and minor details might vary from the time this has been written to the time of release.

In a previous post on ReSharper 6.1 Settings, we introduced the concept of layers and covered a few scenarios when it comes to sharing of settings across solutions. In this post we’re going to cover a few more, namely: syncing settings over DropBox and providing a global setting for all projects across a company.

Syncing with DropBox

As developers we often end up working on multiple machines, whether it is that we own a desktop and laptop, or two desktops, one at work and one at home, or any other combination of scenarios, we have the need to alternate between machines. With the new layers settings in ReSharper 6.1, sharing the same settings in these cases has now become quite easy.

The idea is simple: add a new Global Layer and host the file in a DropBox folder (I’m using DropBox, but obviously you can use any other mechanism that syncs files remotely). In order to do this, we first need to export the current settings to that new file and then mount it.

1. Click ReSharper | Manage Options…

image

2. Select the Global Settings and click on Export to File. It will prompt for a filename. The idea is to place this file in a Dropbox folder. Select everything from the following screen except Housekeeping

image

It is important to note that only items that currently have non-default values will be displayed in this window. For instance, under PattersnAndTemplates, we’d see an entry of StructuredSearch if we were to have some custom patterns in the current context, as shown below

image

3. Select Add Layer | Existing File and select the file created in the previous step.

image

[Note: This screen will most likely be updated in a future release to combine the “ReSharper Global Settings” under the group header as this is a default layer that cannot be removed and therefore cannot intervene in normal operation such as priority]

We now have to repeat step 3 for each of our machines. Once we do that, the settings will automatically be loaded every time DropBox syncs.

Providing Company-Wide Settings

It should be pretty apparent that providing company-wide settings across all projects is pretty much the same as sharing via DropBox. We just need to provide a file. If we want to provide solution company-wide settings, we’d add the layer to the solution group. This would allow an alternative way of sharing settings which wouldn’t require the file to be checked in to source control.

Other operations to perform with Settings

Settings can be imported, exported, activated and deactivated (marking the checkbox or unchecking) at any point. We can also Copy To button to copy settings from one layer to another layer, making it also easy for sharing. In essence you can do pretty much anything you like now.

Why so many layers?

You might be thinking, if I could setup my settings to read from a specific file, why would I want more layers or the ability to order them in priority?. The idea with layers is that each one can add one or more configuration settings. This means that for instance a company could have a layer where only code formatting settings are defined, another layer where templates are defined and so on and so forth. When we export settings to a file as shown in two, we define which settings we want exported. We do not have to select them all like we did previously. We could for instance only choose to export Templates, and mount a layer where only these are defined. ReSharper can understand that there are different options in different layers and provides us access to them all. We don’t have to worry about this. The only thing we might need to take into account is if one layer overrides another one’s settings. That’s where the Move Up / Move Down comes in, allowing us to specify the priority.

Summary

The layers provide a lot of flexibility when it comes to sharing settings, either between two machines, a team or company-wide. Use them, abuse them. Give us your feedback.

Async CTP Support in ReSharper 6.1

Tuesday, November 29th, 2011

This post is about ReSharper 6.1. For other features in ReSharper 6 (both 6.0 and 6.1), please see previous posts introducing ReSharper 6:

If there was one feature that has received ample attention in the run-up to ReSharper 6.1, it would have to be the request for async/await support. Despite the fact that this technology has not yet been finalized, community demand as well as the timely release of a preview version of Visual Studio vNext have convinced the ReSharper team to put in the effort to provide quality support for Async CTP.

And we’re not talking just about support for the keywords, either! The following is a list of some of the features that make working with the new features easy and enjoyable.

  • Keyword completion — somewhat unsurprisingly, async and await are now keywords that ReSharper knows about:
  • Smart completion supports async methods too. In the example below, ReSharper knows that an int return type is expected, and offers appropriate suggestions.
  • ReSharper enforces naming conventions for async methods. The “Async” suffix is configurable in the Options dialog.
  • When changing your methods to become async, you can correct the return type of an async method:
  • ReSharper verifies async propagation, so if you forget to decorate an await‘ing method with async, you will be reminded to do this:

    This also works in cases where the method is anonymous (i.e., a delegate or lambda expression):
  • ReSharper will also complain about the synchronous execution of async methods that do not contain any await instructions in them:
  • Finally, ReSharper comes with a set of analyses helping you ensure correct usage of async and await constructs. For example, in the screenshot below, ReSharper would complain about the fact that ref and out parameters are not permitted in an async method, as well as the fact that null is not awaitable:

Finally, async support permeates various areas of ReSharper infrastructure such as, e.g., its support in SSR (Structured Search & Replace). Overall, the async and await-related features have established themselves in the product, where they will stay and be improved upon until the technology’s eventual release.

ReSharper Settings in 6.1

Tuesday, November 22nd, 2011

This post is about ReSharper 6.1. For other features in ReSharper 6 (both 6.0 and 6.1), please see previous posts introducing ReSharper 6:

EAP Warning: This post is based on ReSharper 6.1 Early Access Program and some things such as screenshots and minor details might vary from the time this has been written to the time of release.

This is a first in a series of posts about some of the new options available in terms of settings with ReSharper 6.1.

One of ReSharper’s pain points has always been settings, specially when it comes to managing them across projects and/or teams. With ReSharper 6.0 we started to make changes to build in support for a new way to manage settings, but unfortunately due to time constraints, we could not get it done in time for the 6.0 release. It has however made it into the 6.1.

Unified Settings Storage

An important change is that all settings have been unified into a single storage mechanism. This means that when you load or save settings, they apply to everything, from code style to templates, patterns and naming conventions. This should make it easier than before where different things were stored in different places.

Settings for every scenario

Everyone has their own style and methodology of working. Some like to name their properties in a certain way, others don’t like to be explicit about their privates. Some use underscores, others don’t. Some like the var suggestions. Others despise it. We are all different.

When it comes to working together, we have to make compromises and settle in a series of settings and ways in which to work. One day, hopefully, we won’t have this limitation and it will be transparent to us, but until then we need to find a way to not only cope with it but define it.

This scenario is very apparent when working on a team, but even as a solo developer, we can still require different settings based on different factors. We can be working on private projects that follow our own standards or be part of an open source team that follows the standards for the OSS project.

We hope with ReSharper’s new settings we can try and accommodate different scenarios. Let’s cover a few of the simpler ones.

Single developer and same settings for all solutions

If you are a solo developer or like to have the same settings across every single solution, then you won’t notice much difference in how you save your settings. You access the settings using the regular ReSharper | Options dialog and once done you press the Save button

image

These are also known as ReSharper Global Settings and are stored in

%AppData%\JetBrains\ReSharper\vAny\GlobalSettingsStorage.DotSettings

making them easily accessible for backup and restore as well as persistence during upgrades.

Different private settings on different solutions

Sometimes we’d like to have different settings based on different solutions, even if we are not necessarily sharing these settings with a team. We’ve made this scenario quite simple too. Once again we open up the ReSharper | Options dialog and make the required changes. This time however, instead of clicking on the Save button, we click on Save To and select  %SolutionName% Solution  – Private where %SolutionName% varies based on the active solution

image

This will create a file called %SolutionName%.SLN.DotSettings.user in the solution folder (in our case ConsoleApplication2.SLN.DotSettings.user) which holds the settings for this particular project. It is important to note that this file should not be checked in to source control as each user would have their own specific settings and thus one would override the other. We recommend that this file be added to the list of files to ignore by the VCS (i.e. add to .gitignore).

Shared team settings

The next step is to have a series of settings shared across the team. As you can guess from the previous screenshot, this is merely just choosing the next option down when saving settings:

image

which will create a a %SolutionName%.SLN.DotSettings file in the solution folder. This file should be checked in to source control.

These cover some of the simple scenarios when it comes to settings. However, sometimes it is not that simple. Often we want to have the best of both worlds. For instance, we might like to have team settings and tweak them a little bit to our own use. That’s where ReSharper’s smart settings come in.

Combining Settings: Layers

Settings in ReSharper are like onions, they have layers, and these layers, combined with what we call internally “smart savings”, provide more flexibility when it comes to tweaking settings.

Say for instance we are using some shared settings from a team settings file checked in with the project, yet there are certain settings we’d like to change privately that only affects us. How would we do this?

Quite simple. We modify the settings we want tweaked and then save it as Solution Private. ReSharper realizes that there are different values for a setting and the layering kicks in which one layer override another one. The actual order of the layering is:

image

Private Settings currently override Solution Shared, which in turn override Global settings. As such, by tweaking the settings to our individual needs (only those required), we can override specific team settings.

[Note: Some have mentioned that this wouldn’t enforce team settings. True, it does not, and we believe in discipline versus constraint.]

Managing Options

You might have noticed that in the ReSharper menu, as well as the Options dialog there is a new entry / button labeled “Manage Options” and “Manage…” respectively. These provide access to managing the different settings layers easily as well as importing/exporting and resetting.

image

When clicking on them, we’re displayed the following dialog:

image

The dialog box lists all the different layers currently available. Out of the box, ReSharper ships with the three we’ve already discussed: Global, Private and Shared with Team. Each of these are appropriately placed in the correct Group, which also happens to be three. From this dialog box we can edit each of these as well as import and export settings.

To edit specific settings, we merely select the one we’re interested in and click on the Edit… button on the top-left corner. This opens up the regular Options dialog box for us, with a minor difference. It now displays the name of the layer we are editing:

image

This difference is also apparent in that the Save To Button is no longer present, as when clicking Save we will automatically save the layer we are editing. When we edit the settings, only those of that specific layer are updated. Everything else stays intact.

Summary

The new ReSharper settings is hopefully designed in a way which allows to not only ease the pain of sharing settings, but provide for a variety of options and maximum flexibility. In the next parts we’ll cover how to add additional layers (including storing settings on Dropbox for instance), re-order, as well as importing and exporting of old and new settings.

ReSharper 6.1 EAP for Visual Studio 11

Thursday, November 10th, 2011

We recently announced the availability of ReSharper 6.1 EAP which includes initial experimental support for VS11. What wasn’t included was an installer, which made the whole support pretty much useless. We only realized this after shipping it and someone tweeting “WTF is VS11 checkbox?”

FAIL!

In all seriousness though, we knew that this was missing. We had intended to provide a VSIX that allows you to install ReSharper 6.1 in VS11 on the same day of the release of EAP, but it didn’t happen. However, that VSIX is now available, and you can obtain it from the nightly build (which btw have resumed) page, as well as the SDK. The evaluation license key for the VSIX is also provided. To install it into VS11, merely close down the IDE, double-click on the VSIX and you’re done.

If you have any issues please report them here or on our forums.

MSpec Runnner Available for ReSharper 6.1 EAP

Thursday, November 10th, 2011

Below is a link to the MSpec binaries compatible with ReSharper 6.1 EAP. This is just a temporary link until MSpec is officially updated by Alex who’s currently chasing Elephants in Uganda!

Download the binaries from here

Please give us feedback here if you have issues.

Thanks.

ReSharper 6.1 EAP Opens: Much More than a Bugfix Release

Friday, November 4th, 2011

It took longer than expected but here we are, opening the ReSharper 6.1 Early Access Program that’s meant to eliminate any pain points you might be having with ReSharper 6.0, via performance and bug fixes. However, ReSharper 6.1 also provides a lot of new functionality that all 6.0 users will be getting as a free upgrade.

UPDATE! ReSharper 6.1 is officially released, Early Access Program is over.

Here are some of the best reasons why you should totally try ReSharper 6.1:

  • Performance fixes: Has ReSharper 6.0 been harsh on you performance-wise? Has it been processing source files longer than expected? 6.1 shouldn’t. Here’s the list of performance issues that have been fixed.
  • Bug fixes. The list of bugs fixed for 6.1 is here for you, highlighted by massive efforts to improve unit testing, structural search and replace, VB.NET code resolve, as well as code completion and typing assistance in ASP.NET MVC 3 (Razor).
  • New settings engine. Settings have been revamped extensively, with extra emphasis on sharing and managing them. We have made many more settings accessible and sharable, and introduced new granular settings — for example, those for IntelliSense behavior for different languages. Settings are now layered meaning that you can define global, per-solution, per-team or individual settings. You can now export and import all or selected settings to/from a single file — for this and other settings management operations, use the new Manage button under ReSharper > Options.

  • Here’s a rough list of settings-related problems solved for 6.1. Mind you, nothing is set in stone yet. We’re still making changes to this subsystem, and we’ll do that based on feedback from you and your team.

  • Support for Async CTP. You have asked for it: Not only does ReSharper 6.1 support async and await keywords — both in C# and VB.NET — but it also provides a set of code inspections and quick-fixes: for example, it sees dead code when an asynchronous method lacks await operators, and warns when you’re using a wrong return type in an asynchronous method.
  • Optimize Assembly References. This has been requested for even longer, and here it is: ReSharper 6.1 detects any references that are not effectively used in your project, and provides a nicely built UI to get rid of all or some of them. Project maintenance just got easier with ReSharper!
  • Experimental support for the initial Visual Studio 11 Developer Preview. We have adapted ReSharper to run under Dev11, and it does so fairly well with existing code. Manual setup is required here, and we’ll follow up with a post containing VS11 install guidelines. However, please understand that this is only initial, experimental support for existing types of projects with a specific Developer Preview build (the one made available on September 16, 2011.) We can’t guarantee any consistency of your experience with ReSharper 6.1 EAP (or even the future release of 6.1) under VS11 Developer Preview. Needless to say, no support for developing Metro style applications is there. Official support for VS11 will not be made available any earlier than the next major ReSharper release.
  • ReSharper SDK. This is something that should simplify ReSharper plug-in development dramatically. Delivered as an MSI or ZIP file, the SDK provides a full set of ReSharper assemblies, including test infrastructure assemblies required to test ReSharper plug-ins, target files, and (in the MSI version) Visual Studio templates for creating different kinds of plug-in projects.
  • A great load of improvements relevant to web developers. This includes new quick-fixes and refactorings for CSS; Structural Search and Replace for HTML and ASP.NET; Move Helper refactoring, internationalization and Call Tracking for ASP.NET MVC 3; generation of event subscriptions in ASP.NET; a UI to configure path mappings for web site deployment; and many more improvements, some major, others not so much, that we’ll be expanding upon in a separate blog post.
  • New code inspections and quick-fixes for C# and VB.NET. Aside from the set of Async CTP related inspections, ReSharper 6.1 has also improved in terms of control flow redundancy analysis (for instance, detecting more cases of redundant return statements); it also detects access to disposed closure and covariant array conversions, and provides corresponding quick-fixes where available.
  • XAML support improvements including code completion enhanced in certain scenarios, batch generation of event subscriptions, improved attached property awareness in error highlighting and code completion, as well as an option to create a namespace alias from usage:

We have also added a new refactoring to convert iterators to methods; internationalization for VB.NET projects; navigation and search updates including Quick Search in Type Hierarchy window, export to HTML and XML from all tool windows supporting import/export functionality; and more. There are simply too much changes, subtle and prominent, to summarize in a single blog post without turning it into an encyclopedia.

For die-hard fans, here’s the list of all YouTrack issues fixed for 6.1.

Go forward and download ReSharper 6.1 EAP builds ReSharper 6.1 official release, and expect more blog posts covering 6.1 functionality in greater detail to come up soon.

New Features in ReSharper 6 Unit Test Runner

Tuesday, August 23rd, 2011

Previous posts introducing ReSharper 6:

ReSharper 6 includes a series of new features and improvements in the test runner, as outlined below.

NUnit TestCase

We now fully support NUnit’s TestCase, TestCaseSource, Values, Ranges and other attributes. Given the following tests:

image

ReSharper outputs the results as individual tests, appropriately grouped.

image

This allows us to now run and view tests individually.

image

As expected, dotCover and dotTrace also provide support for this.

Support for Coded UI Tests with MSTest

Coded UI tests (when appropriate) are also supported now with the ReSharper test runner

image

Default Keyboard Bindings and Test Re-Runs

Out of the box ReSharper now ships with pre-defined shortcut keys for running, debugging, re-running tests, among other things. This eases the pain of having to map keys on new installations (as of ReSharper 6, you no longer loose your key bindings during upgrades!). By default, the key-bindings for the schemes are:

Operation Visual Studio IntelliJ IDEA
Run Unit Tests. Context Sensitive Ctrl+U, R Ctrl+T, R
Debug Unit Tests. Context Sensitive Ctrl+U, D Ctrl+T, D
Run ALL Unit Tests Ctrl+U, L Ctrl+T, L
Run Current Session Ctrl+U, Y Ctrl+T, Y
Rerun last test. Context Insensitiveimage Ctrl+U, U Ctrl+T, T

This last shortcut is a new feature added in 6 which allows us to re-run the last test we just ran. And we can run it from anywhere! This makes TDD for instance very easy as we can write some code, be in the actual code and run the test, without having to switch back to the test or open up the unit text explorer.

Running Tests from File Structure and Find Results Windows

You can now run Tests directly from the File Structure Window

SNAGHTML14c0e0a

as well as the Find Results Window

SNAGHTML14d0b1d

again, removing some of the friction when it comes to testing.

Categories

Certain Unit Testing frameworks provide test categories. For example, in NUnit there is the [Category] attribute. ReSharper now allows us to ignore specific categories and not run them during a test run. This is accomplished by indicating the category under ReSharper | Options | Unit Testing

image

When running unit tests, these appear as ignored.

image

This is useful for instance when we want to avoid running certain tests during development sessions.

Categories can also be used to run a specific group of tests by selecting these from the context menus:

image

Other improvements

Some other minor improvement or previous features we have blogged about include:

  • QUnit Support
  • Unit testing Sessions are now persisted between Visual Studio restarts
  • Ability to run tests in parallel from different assemblies, decreasing testing time (can be turned off in ReSharper | Options | Unit Testing)
  • General performance improvements
  • Update Progress indicator on Windows task bar

image

As always, we welcome your feedback

File Header Macros in ReSharper 6

Monday, July 25th, 2011

Previous posts introducing ReSharper 6:


Sometime ago I wrote about Automating File Header Information, showing how to insert license information and other data in project files. One of the shortcomings ReSharper had however was the inability to support macros. Something as simple as inserting the current year or filename required the support of StyleCop for ReSharper. ReSharper 6 now support macros allowing file headers to contain varying information:

SNAGHTML13afe47c

For instance, in the previous license header, the Copyright years are fixed to 2010 – 2011. It also has no information relevant to the actual project. We could of course hardcode the name of the project in there but since this setting is not solution-specific, it would be of little use. Other data such a filenames however would be impossible to do.

With ReSharper 6 we simply remove the hardcoded values and replace them with macros. We can either type them in or click on the corresponding macro, which will insert it at current cursor position:

image

With this change in place, next time we run a code-cleanup and have the Update File Header option activated, we will get up to date and project/file specific header information inserted. Next feature request: Custom Macros!

Machine.Specifications for ReSharper 6 now available

Wednesday, July 20th, 2011

Many, including myself have been eagerly awaiting the release of the ReSharper Runner of Machine.Specification (MSpec) for ReSharper 6. I’m glad to announce that this is now available, which is the result of a team-effort between Victor Kropp, Chris Nicola, myself and of course Alexander Gross, long-time contributor and main maintainer of the MSpec project.

NuGet packages have already been updated to support ReSharper 6. The source code can also be obtained via SymbolSource.org if using NuGet or directly from Alexander’s GitHub account.

Installing the Runner in ReSharper 6

If you’re new to MSpec or have simply forgotten how to install the runner under ReSharper, here are some simple steps to use Mspec in your project and integrate it with ReSharper:

1. Run the command install-package Machine.Specifications (or Machine.Specifications-Signed if you want the signed version). If this is an existing project, issue the command update-package instead of install-package.

2. Inside the packages folder corresponding to Machine.Specifications, a tools folder is created with a series of assemblies and some batch files. There’s a series of batch files named InstallResharperRunner.X.X. – VS20XX.bat where X’s correspond to the version of ReSharper and of Visual Studio. By executing the corresponding one, it will copy the assemblies to the ReSharper plug-in folder.

You can of course do the second step manually, by copying the Machine.Specifications.ReSharperRunner.X.Y files to the ReSharper Plugins folder, located either under the ReSharper bin folder in %Program Files%\JetBrains\ReSharperX\bin (for all users) or under %APPDATA%\JetBrains\ReSharperX\bin (user-specific settings).

With that you should be up and running.

Enjoy.

ReSharper 6 is Released!

Thursday, June 30th, 2011

We are extremely happy to announce the release of the new ReSharper: please download ReSharper 6 right now.

With this new release, we have gone way and beyond merely providing new features. We have added support for not one but three new languages: JavaScript, CSS and HTML, plus ASP.NET MVC 3 Razor view engine, making ReSharper 6 and Visual Studio one of the best environments today for developing web applications. In addition we also have implemented code analysis for Visual Basic .NET.

The features however aren’t limited to just new language support. Earlier in the year, we announced our new decompiler, which is built in to the core of ReSharper 6, providing integrated decompiling inside Visual Studio. Built on the philosophy of external sources, ReSharper 6 facilitates navigation of source code, whether it belongs to our solution, the .NET framework or any third party library. We also announced the availability of a new free standalone decompiler tool, which is currently in Early Access Program.

ReSharper 6 also provides a wealth of rich features for all language lovers. From new in-place refactorings, to enhancements in navigation and unit testing, new code transformations, code inspections for C#, improved XAML support, ReSharper 6 provides something for everyone.

If you prefer watching over reading about the new features, here’s a fresh screencast for you:

Also, we have previously blogged about some of the new features of ReSharper 6, and we’ll be keep doing that after release.

We have also opened our Early Access Program for dotCover 1.1.1 and dotTrace Performance 4.5.1 which are compatible with ReSharper 6.

We truly hope you enjoy this new release and know that we have already started working on the next version. As always, we’d love to hear your feedback.

Last but not least, if you’re after regular tips and tricks on ReSharper and release cycle news, don’t forget to follow ReSharper on twitter.