Dec
3
2009

ProjectReference with Condition in your MSBuild project files

Since some time I have the current scenario where I need to have conditional reference in a project. Basically the application must reference an assembly in one case in other it should reference another one. This was working correctly from an MSBuild point of view as the first implemented solution let me compile and run the application on my development machine and it was also working for our TeamCity build server. So everything was fine in this perfect word expect one thing!

The issue was the following; Visual Studio was showing two references of the ‘same assembly’ with different path. Not really an issue you would say because the correct one was used at compile time and at run time in all configurations. So the issue was that this had an impact of ReSharper. And this is I cannot accept because it affect my productivity.

So the other day I had a discussion with Ilya of JetBrains which gave me some idea but also told me that ReSharper reads project structure out of Visual Studio and that it doesn't provide lots of info, e.g. conditions on references. So this is why seeing two reference of the ‘same assembly’ was not a problem on Visual Studio itself and on the build server but was an issue to ReSharper because it was seeing two same reference, same namespace, same classes…

Today I had some time free and decided to see where I can come with this issue. And I found a solution.

My first solution, which had the explained issue was the same as the one on this post “Don't be afraid of your csproj-Files (III): We have a condition”, so having a Condition on the ItemGroup.

The solution I came to is to bring the Condition to one upper level than the ItemGroup, so I used Choose like this:

  1. <Choose>
  2.   <When Condition=" '$(Configuration)' == 'client1DeployClickOnce' ">
  3.     <ItemGroup>
  4.         <ProjectReferenceInclude="..\client1\app.Controls\app.Controls.csproj">
  5.         <Project>{A7714633-66D7-4099-A255-5A911DB7BED8}</Project>
  6.         <Name>app.Controls %28Sources\client1\app.Controls%29</Name>
  7.       </ProjectReference>
  8.     </ItemGroup>
  9.   </When>
  10.   <Otherwise>
  11.     <ItemGroup>
  12.       <ProjectReference Include="..\app.Controls\app.Controls.csproj">
  13.         <Project>{2E6D4065-E042-44B9-A569-FA1C36F1BDCE}</Project>
  14.         <Name>app.Controls %28Sources\app.Controls%29</Name>
  15.       </ProjectReference>
  16.     </ItemGroup>
  17.   </Otherwise>
  18. </Choose>

Reloading the project I had the surprise to see only one reference and that ReSharper was working again correctly!

For sure the build on TeamCity is also working perfectly.

Oct
13
2009

ReSharper 5.0 Overview

As part of the Jetbrains Academy I am using/testing ReSharper 5 for around a month now. It is quite stable for a pre-release and I have lots of fun using it, and as always a productivity boost. Some of my preferred features are: External Sources, ASP.NET MVC integration, Solution-Wide Warnings and Suggestions, Upgrade-to-LINQ Actions. Till now I wasn’t able to test the Native NUnit Support, but this is definitely something I will test in the near future.

Jetbrains just posted on their blog ReSharper 5.0 Overview, check it out:

As promised, we’re publishing general ReSharper 5.0 overview, elaborating on its feature set in more detail.

Please keep in mind that this is a preliminary document. The general picture will stay unchanged but local amendments can not be ruled out at this point, and many user interface items will probably change.

Features
  • External Sources
    A solution is not limited to sources included in your projects, but it also contains sources that were used to build your libraries. Some companies publish parts of their sources using the Source Server feature of debug information files (PDB). This is the same technology that Microsoft uses to provide access to source code for parts of .NET Framework. With ReSharper 5, you can now access it as if it were a part of your solution. When no sources are available, ReSharper does a decent job of reconstructing types’ structure from metadata for your browsing pleasure.
  • Structured Patterns
    “I was assigned to new project, and the source code is full of [your favorite code smell here]. Please, make ReSharper analyze and fix it!”. Fortunately, ReSharper 5 can address this demand. You can set up your own code patterns, search for them, replace them, include them into code analysis, and even use quick fixes to replace! Building patterns and enforcing good practices has never been easier. Corporate and team policies, your own frameworks, favorite open source libraries and tools — you can cover them all.
  • Project Refactorings and Dependencies View
    Once you are used to smart, automated refactorings provided by ReSharper, you can’t think of executing them manually anymore. In this release, we extend ReSharper’s coverage to bring you several refactorings for project structure. With ReSharper 5, you can move files and folders between projects, synchronize namespaces to folder structure in any scope as large as solution, safely delete obsolete subsystems without going type by type, and split a file with lots of types created from usages into their own dedicated files in one go. We have also added special project dependencies view to help you track down excessive dependencies between projects and eliminate them. As an early ReSharper 5 user said, “I no longer feel fear to restructure my project. I just go and do it when I feel it is right to do so”.
  • Call Tracking
    Find usages, find usages, find usages. Formerly, attempting to track call sequences in code could end up with lost context, lots of Find Results windows and frustration. With ReSharper 5, you can inspect an entire call sequence in a single window in a simple and straightforward manner. Stuck in unfamiliar code? ReSharper’s code inspecting tools for the rescue!
  • Value Tracking
    Value Tracking provides you with important information about data flow in your program. At any point in your source code, select a variable, parameter, field or property and ask ReSharper to inspect it. You will then see how its value flows through your program, back to its sources or straight to consumers. Wonder how null could be passed to a specific parameter? Track it!
  • Internationalization
    Software localization and globalization has always been a tough and at times unwanted task for developers. ReSharper 5 greatly simplifies the process of working with resources by providing a full stack of features for ResX files and resource usages in C# and VB.NET code, in ASP.NET and XAML markup. Move string to resource, Find usages of resource and other navigation features, refactoring support, inspections and fixes — all ReSharper goodness for your localization pleasure.
Technologies and Languages
  • Visual Studio 2010
    We will publish more information about Visual Studio 2010 support when VS Beta 2 is released. Currently, ReSharper 5 builds support Visual Studio 2005 and Visual Studio 2008.
  • C# 4 and VB10
    New language versions appear at a great speed nowadays, and ReSharper team works hard to support them right when you need them. ReSharper 5 provides beta support for C# 4 and VB10, as Visual Studio 2010 does itself. Variance, dynamic types, named arguments and optional parameters, embedded COM assemblies — all of these features are supported in the new ReSharper. During VS 2010 Beta 2 phase we’re hoping to learn from your experience using these features and improve their support for Visual Studio 2010 release.
  • ASP.NET
    With this new version, ReSharper support for ASP.NET is improved tenfold. In addition to performance and responsiveness improvements, lots of new features for ASP.NET markup files are introduced to make your life easier. Web-specific navigation, master page support, new inspections and syntax highlighting for web files, File Structure and Go to File Member for in-page navigation and overview, live templates for common markup and more!
  • ASP.NET MVC
    ASP.NET MVC deserved our special attention: special syntax highlighting, inspections, navigation to and from action or controller, and even actions to create new types and methods from usage in pages.
Productivity
  • IntelliSense
    ReSharper continues to bring first-class IntelliSense experience, and the new version gives even more. We have added automatic completion for enum members and boolean values, made automatic triggering smarter, and greatly improved speed. Completion for unresolved symbols in local scope is a new ReSharper IntelliSense feature. Another improvement is completion for all-lower text with CamelHumps  — to make cocopro match CodeCompletionProvider — and that means you don’t need to press Shift too often.
  • Bookmarks
    This is a simple yet powerful feature: drop a numbered marker with a single shortcut, jump back at any time with another keyboard key. Up to 10 numbered bookmarks, unlimited unnumbered bookmarks, full list of bookmarked positions in a single pop-up window — all to help you switch between several code spots instantly.
Inspections
  • Solution-Wide Warnings and Suggestions
    We have received a lot of positive feedback from our users regarding solution-wide error analysis that allows you to immediately see compilation errors in whole solution. In ReSharper 5, we took this technology to a new level by adding warnings and suggestions to the list. Now you can browse code smells that ReSharper finds across your solution and quickly improve quality of your code.
  • Upgrade-to-LINQ Actions
    With C# 3.0 and LINQ, developers are able to write data-intensive code more easily by directly describing their intent to the compiler. However, years of imperative programming left us with tons of foreach-style code waiting to be upgraded. ReSharper 5 detects parts of your code that can be rewritten using the new LINQ syntax and suggests to make the conversion automatically, to make the developer’s intent crystal clear.
  • Use IEnumerable Where Possible
    With the power of LINQ, IEnumerable is more than enough to pass a collection of values. So why restrict yourself with API requiring you to pass old-school arrays, Lists and ArrayLists? ReSharper will scan your code base to detect methods that can safely return and accept IEnumerable instead of a more specific type. Of course, we will also take care of the conversion.
  • New and Improved Code Inspections
    We have collected rich customer feedback and went through a list of common errors that developers make in code. Based on that, we have added a ton of highly intelligent inspections to immediately boost your .NET expertise. For example, if you take your API seriously and want it to be well documented, ReSharper will help you by highlighting errors in XML comments.
Other improvements
  • Native NUnit Support
    ReSharper 5 introduces a completely new approach to running your NUnit tests. Our engine is now based on native NUnit code. What it means to you is 100% compatibility with the latest released version of NUnit and full support of its recent unit testing features.
  • XML Formatting
    XML data is an important part of modern applications and you want it to be in order. The new version of ReSharper is supplied with superb configurable formatter for XML files.
Oct
8
2009

Unit Tests without leaving the keyboard

I like the Roy Osherove blog: Five Whys, Leadership in software teams.

Follow up on those two posts “How to measure programmer productivity using TDD Katas” or “Be Productive and Go Mouseless”. I would like to share a little keyboard shortcut which save me quite some time on my daily developments.

As you might know I am a fan of ReSharper and when I am doing Test Driven Development I hate having to switch from keyboard to mouse to run the test I just wrote. So searching for ReSharper Keyboard command I found Resharper_UnitTest_ContextRun which I assign to the Ctrl+Shift+<.

Now I can run the unit test I just wrote with just a combination of keys which are really near to each other so really easy!

The bonus of this command is that if I have the cursor in one unit test in a TestFixture class then it will run that particular test, but if I have the cursor out of any unit test method it will run all tests of that TextFixture. Very efficient!

Enjoy it!

Sep
6
2009

Joining JetBrains Academy

I am pleased to announce that I was invited to join JetBrains Development Academy and accepted the invitation.

3860358212_196cfab6b6_o[1]

If you read this blog I guess you already know that I am a big fan of their development tools, especially ReSharper and Team City which make my daily job easier and more productive.

About JetBrains Development Academy:

Mission Statement

The JetBrains Development Academy fosters a community of experts and evangelists to champion best development practices and promote software innovation worldwide. The Academy serves as a connection point for developers who strive to adopt top methodologies and use JetBrains products to help them achieve that goal.

Membership

Members of the Academy are recognized experts in various areas of software development. They contribute to Java and .NET communities by advocating best development practices through formal and informal publications and meetings, and serve as a versatile source of expertise.

Community Benefits
  • Increased awareness of and adherence to best development practices
  • New channels for community involvement and exchange
  • Access to know-how from JetBrains insiders and outside experts
  • Accelerated innovation and enhanced product quality for end users
  • Opportunities for growth on personal, organization and community levels

You can find more about my posts on ReSharper on this page and about Team City on that one.

May
9
2009

Updated my Live Template for NUnit in ReSharper

I tend to use a lot the Live Template of ReSharper, for example working for some time now with the WPF MVVM pattern I created a ViewModel template of such a class and use it extensively.

Today I updated the File Template I use to write my NUnit tests like this:

using NUnit.Framework;

namespace $NAMESPACE$
{
    // ReSharper disable InconsistentNaming

    [TestFixture]
    public class $CLASSNAME$
    {       
        /*
         * ... hold ...
         *
         * Arrange - Act - Assert
         */

        [Test]
        public void $FIRST_TEST_NAME$()
        {
            $END$
        }
    }

   // ReSharper restore InconsistentNaming
}

where I have the variable names defined as this:

Apr
10
2009

ReSharper 4.5 released

As you might have realized following my blog, I am big fan of JetBrains ReSharper for quite some years! This tool really boost my productivity. Today they just realized ReSharper 4.5 which brings some new functionalities but also a huge improvement in performance.

What's New in ReSharper 4.5

ReSharper 4.5 delivers a great performance boost, new features and more. Read about them below or watch this Live Demo

Performance and Memory Usage Improvements

ReSharper loads and works faster and more smoothly in general, particularly on big solutions: now it takes 20 to 40 percent less time until the solution is ready for code editing. Website loading time has been reduced by 30%. Other accelerated operations include: renaming symbols, finding commonly used symbols, creating symbols from usage, and analyzing large XAML files. Memory requirements for analysis of jumbo autogenerated code files have been reduced. Read more »

Solution-Wide Code Inspections

To detect unused non-private members on the fly, we have improved our solution-wide analysis by introducing a set of specialized code inspections. They only work when you let ReSharper analyze your whole solution and help you discover: unused non-private declarations; unused return values of non-private methods; unaccessed non-private fields; unused parameters in non-private members; and more. Read more »

VB9 Support

Visual Basic .NET developers can now benefit from VB9 language support that includes implicitly typed local variables, object initializers, anonymous types, extension methods, lambda expressions, partial methods, and embedded XML. VB9 support is all around you, courtesy of new context actions, code completion, refactorings, and Parameter Info, among other supporting features. Read more »

Extended Naming Style Configuration

You can now define custom naming style settings for different languages and symbols including types, namespaces, interfaces, parameters, method properties and events, static and instance fields etc. Use them to precisely align the way ReSharper completes and generates code with your specific coding guidelines. Read more »

Other Enhancements

Go to Implementation — Jump from usage of a base type or member straight to any of its end implementations.
New and Improved Refactorings — Added Inline Field and refactored many other refactorings for greater performance.

Native MSTest Support — Finally provided natively in ReSharper on par with nUnit support.
Wider Cross-Language Capabilities — More efficient quick-fixes and context actions in many cross-language scenarios, as well as increased coverage for XAML and ASP.NET.
Smoother Language and Framework Support — Improved compatibility with F#, Compact Framework, Silverlight 2 and other languages and tools. Read more »

Download ReSharper

Mar
14
2009

ReSharper 4.5 Beta Released

Jura Gorohovsky just posted on the release of a public beta of ReSharper 4.5

Your wait is almost over: ReSharper 4.5 has gone public beta, and the official release is just a few weeks away!
After significantly expanding the set of ReSharper features in previous releases, we’ve shifted focus to the issues of performance and memory usage. Making the tool more agile, robust and responsive was our main goal when developing ReSharper 4.5.
ReSharper 4.5 brings a wide-ranging set of improvements that go way beyond performance enhancements:

  • Performance and memory consumption: When working on large solutions, you’ll feel a great deal of difference between ReSharper 4.0 and 4.5.
  • New solution-wide warnings and suggestions: Analyze usage of non-private types and type members within your whole solution.
  • Visual Basic 9 support: ReSharper’s cross-language refactorings and editing experience enhancements now provide support for VB9 code.
  • Extended setup for naming conventions, which are now supported by all ReSharper features.
  • New Inline Field refactoring and enhancements in existing refactorings.
  • Go to Implementation: Go from usage of a class or method straight to its end implementation, bypassing abstract classes and/or interfaces.


To get your hands on the public beta, download it now!

I am using the EAP for quite some time and the performance improvement are remarkable!

Jun
25
2008

ReSharper and Source Analysis Tools for C#

If you do have Microsoft Source Analysis Tools for C# and JetBrains ReSharper 4.0 installed in you development environment than you might get issue when you run your unit tests through ReSharper Unit Test Explorer and Sessions. As you can read on my bug report feedback:

There is known problem in StyleCop, which prevents build system of VS to report any progress. Unit Testing waits for project to be built. You can switch building to "Never" on Session toolbar and build manually, or uninstall StyleCop

Jun
13
2008

ReSharper 4.0 with C# 3.0 support, JetBrains releases the ultimate Visual Studio plugin

JetBrains has released their ultimate Visual Studio plugin, ReSharper 4.0.

This much-anticipated productivity tool includes many new features and improvements.

It supports C# 3.0 and LINQ, plugs nicely into Visual Studio 2008 and 2005 and also support VB.NET.

It includes:

  • Full Support for C# 3.0 and LINQ; Full Edition and C# Edition provide comprehensive support for C# 3.0, including LINQ, implicitly typed locals and arrays, extension methods, automatic properties, lambda expressions, object & collection initializers, anonymous types, expression trees, and partial methods
  • Comprehensive Insight into .NET Framework
  • Solution-Wide Analysis, which looks for erroneous C# code in your whole solution on-the-fly, without compiling it first
  • Code Cleanup, flexible code compliance and formatting tool bringing together a dozen of ReSharper features. In addition to fine-tuning formatting style to use, you can opt to arrange 'this' qualifier, remove code redundancies, convert properties with backup fields to auto-properties, make fields read-only if possible, optimize using directives, shorten qualified references, update file header, replace explicit types with vars, and revamp your C# code with many more settings
  • New Refactorings
    • Convert Static to Extension Method
    • Convert Extension Method to Plain Static
    • Convert Property to Auto-Property
    • Convert Anonymous to Named Type
    • Inline Method
    • Convert Method to Indexer (to Default Property in VB.NET)
    • Convert Indexer (Default Property in VB.NET) to Method
  • Multiple New Productivity Features
    • Complete statement; inserts necessary syntax elements (braces, semicolons etc.) and gets you to the position to start the next statement, saving you from excessive juggling with the caret.
    • CamelHumps in Code Completion, allowing you to complete any symbol by entering only its uppercase characters.
    • Live Templates Editor & Manager, rejuvenated set of user interface items for viewing, managing, and editing all three types of templates — Live Templates, Surround With Templates, and File Templates.
    • Recent Edits, drop-down list similar to existing Go To features that shows files and symbols that you recently modified.
  • Smoother Interaction with Visual Studio Ecosystem
  • ASP.NET Speedup; significantly speed-up the analysis of ASP.NET pages 

You might read more details about all new features or the full list of features.

I recommend printing the keyboards shortcuts available in ReSharper 2.x / IDEA scheme and Visual Studio scheme.

You might also be interested by all the ReSharper’s plugins available: Gallio, RGreatEx, Agent Smith 1.1.8, Agent Johnson, ARP Another ReSharper Plugin, NHibernate Plugin 1.0, NSpecify, Scout plugin, xUnit.net 1.0

Finally you can download a free 30-day trial version of ReSharper 4.0. Go download it, it is just a must (at least for me and some others ;)!

May
20
2008

JetBrains ReSharper 4.0 EAP - First Beta Candidate released

JetBrains just released a First Candidate release of ReSharper 4.0 marked as Stable!

Date Build # Links Status Comment Known problems Fixed issues
19 May 2008 804 Download Beta Candidate Stable None Fixes
You might read more about this version 4.0 on the ReSharper 4.0 EAP Notes

I am using the 4.0 EAP for quite some time and I am really happy with it! In fact I just can't work without ReSharper!

About Laurent

Laurent Kempé

Laurent Kempé is the editor, founder, and primary contributor of Tech Head Brothers, a French portal about Microsoft .NET technologies.

He is currently employed by Innoveo Solutions since 10/2007 as a Senior Solution Architect and certified Scrum Master.

Founder, owner and Managing Partner of Jobping, which provides a unique and efficient platform for connecting Microsoft skilled job seekers with employers using Microsoft technologies.

Laurent was awarded Most Valuable Professional (MVP) by Microsoft from April 2002 to April 2012.

JetBrains Academy Member
Certified ScrumMaster
My status

Twitter

Flickr

www.flickr.com
This is a Flickr badge showing public photos and videos from Laurent Kempé. Make your own badge here.

Month List

Page List