Mark Miller
  • CodeRush – New Release (v17.2.8)

    Another 30 days. Another release. This update to CodeRush brings neat improvements to Smart Duplicate Selection, a port of Invert Selection, and the ability to quickly turn code into templates.

    Coding Assistance

    Smart Duplicate Selection/Line (Shift+Enter) gets the following improvements:

    • Single letter identifier parts are automatically incremented/decremented if CodeRush detects an alphabetically-ordered pattern in the code:
         


    • Enhanced support for duplicating parameters and arguments, letting you quickly declare new parameters based on existing parameters and the selection. To duplicate a parameter, select the part(s) you want to change (selected parts will become fields) and press Shift+Enter. Watch the videos below to see examples of what you can do.

      • Arguments


      • Parameters:


    • Expressions can now be duplicated. You can duplicate elements combined with a variety of different operators: string concatenation, bitwise, Boolean and arithmetic. Smart Duplicate Selection will insert a default operator and mark it with a TextField so you can change it later if needed. Watch the video below for examples of what you can do:


    Refactorings and Code Providers

    The Invert Selection code provider gets a port from CodeRush Classic. Use this code provider to invert selected lines of code in a variety of ways:

    • Assignments (a = b  →  b = a)
    • Boolean literals (true  →  false)
    • Addition/subtraction assignments (a += b  →  a -= b)
    • Equality operators (==  →  !=)

    Templates

    We have added the ability to create templates right from a code selection using a context menu. Simply select the code to become the basis for your template, right-click and choose Selection to Template...

    Sel2Templ1

    Sel2Templ2


    CodeRush automatically creates Links and Fields based on the selected code and opens the new template in the Template Editor.

    Give CodeRush a Try!

    Download CodeRush from the Visual Studio Marketplace. And if you're enjoying CodeRush, please leave a review here so the whole world can see.

  • CodeRush 17.2.7 for Visual Studio is Now Available

    In this month’s release, we add automatic block and statement formatting options, the test runner UI gets some improvements, and we introduce the Feature Advisor to help you get more out of CodeRush. Download the latest version of CodeRush at the Visual Studio Marketplace. Here’s more on what’s new:

    Feature Advisor

    The Feature Advisor introduces CodeRush features likely to improve your coding efficiency based on the ways you create and modify code in the editor.

    When CodeRush notices code created or modified in ways which CodeRush features can do faster, it adds an entry to the feature advisor and increments the red and white counter in the bottom right of Visual Studio:

    FeatureAdvisorNotification

    Click this counter to open the Feature Advisor window to learn more about the new CodeRush features that can help.

    FeatureAdvisor

    The Feature Advisor options page shows the full list of features supported by Feature Advisor and lets you disable hinting for features you already know how to use.

    FeatureAdvisorOptions

    Code Formatting

    We have added new options to Format statements and blocks after pressing the } and ; keys.

    FormatOnBrace

    Unit Testing

    The world’s fastest test runner gets some improvements to help you analyze and use test run results faster.

    • You can now select and copy text from the Test Runner’s Results section.

    TestRunnerSel

    • We have added a right-click radio button action to category buttons in the filtering toolbar. When you right-click a filter item, that item becomes the only filter checked.
    • When all filtering items are unchecked, the Test Runner Window shows all tests without filtering.
    • The Test Runner hints shown in the code editor now let you select and copy expected and actual values.

    TestRunnerHint

    Give it a Try

    Download the latest version and let us know what you think about it. Our goal is to make CodeRush the fastest, most powerful code-creation tool for developers. Tell us how we’re doing. And if you love something about CodeRush, you can tell the world about it here. As always, we thank you for your support.

  • CodeRush 17.2.6 is Available (and Includes a New Killer Feature for Visual Studio)

    Another 30 day sprint, another CodeRush release for Visual Studio. And this release includes a powerful new feature we’ve been working on that we think you’ll love. Let’s get right into it:

    Smart Duplicate Selection

    CodeRush’s Smart Duplicate Line (SDL) gets even smarter and morphs into Smart Duplicate Selection. This feature makes creating structurally-similar code significantly easier, and orders of magnitude faster.

    This feature can be used in any language you can work on in Visual Studio, however its intelligence and abilities vary depending on the content you’re building, so let’s go through a few samples to get an idea of what it can do.

    First, let’s start with some C# test code that creates a new instance of a Ninja, like this:

    CreateNinja

    Now I might want to create more Ninjas for the unit test. Normally I would select the block of Ninja-building code, copy it to the clipboard, move the caret to the end of the block, paste the copied code, then navigate into the new code, change a part needed to create my second Ninja, and then repeat these last two steps until the new ninja code is done.

    Phew! That’s a lot of work just to create a second Ninja.

    Smart Duplicate Selection (SDS) starts the same way - select the code you want to duplicate. But instead of copying anything to the clipboard, just press Shift+Enter to duplicate the selection.

    ninjaDup1

    SDS duplicates the selection, placing text fields around the code - parts likely to change in the duplication. Don’t worry if you see a lot of text fields when you first try this. If I’m on a text field and I don’t want to change it, I press Enter to move on to the next text field. I’ll show you how to clean this up in a moment. For now, let’s focus on the changes we want to make to this duplicated block.

    For example, I might change the variable name to “ninja2”, the Name to “Leonardo”, ServedInOniwaban to true, and the birth year to 1985. pressing Enter after each edit.

    It’s fast and efficient.

    But this feature gets even smarter when you try to duplicate again. Let’s create a third Ninja based on the changes we just made.

    Now, you could select the second Ninja-building block we just edited, and press Shift+Enter again. And while that would work, it would be an excessive number of key presses just to repeat the last duplication.

    Fortunately SDS gives you a super-fast way to repeat the last duplication - just press Shift+Enter again when you reach the end of the duplicated selection (or when the caret is inside any text field of the duplication).

    Pressing Shift+Enter (in our ninja-building example) to repeat the last duplication, we now get something more closely reflecting what we want to modify:

    ninja3

    Now we have only four fields, surrounding the duplicated code we changed in the ninja2 declaration. SDS also auto-increments the variable’s name (and other numeric primitives and enums) based on the changes made to the code.

    With only four fields we just change or accept what we need, pressing Enter between changes four times.

    It’s pretty amazing stuff. You can create structurally similar blocks of code or script or markup or any text at all, changing only the parts you need, and create multiples of that with what some might consider the fewest keystrokes possible.

    Once SDS learns what we want to change, we can repeat it by continuing to press Shift+Enter when we reach the end of the duplicated selection (or when we’re inside any TextField of the duplication).

    It’s the most efficient path to creating similar repeating blocks of code/script/markup/text.

    You might also be wondering, “well, what if I already know what fields I want to modify?”

    This question is best answered in a second example. Let’s switch over to XAML, where we might be creating an interface that (so far) looks like this:

    XamlInstallationUI1

    This UI shows download progress, but we want to add similar status controls to show progress for installation, configuration, and registration (all of which happen during our install).

    The XAML for the “Download: 0%” part of the UI looks like this:

    We’ve got a horizontal StackPanel containing two TextBlocks, one for the label and the other, named, for the value. So, we need to duplicate this StackPanel and its children three more times. And in each duplication, we want to change only the Text of the label TextBlock and the Name of the value TextBlock.

    Since we already know what fields we want to change, we can mark those using CodeRush’s multi-select feature. It’s easy. Just select the sections of code you want to modify and press Ctrl+Alt+Enter. Like this:

    PreselectSDS

    Notice I’ve only multi-selected one instance of “Download”, even though I want to also modify the name of the second occurrence in “tbDownload”.

    That’s okay, because SDS will automatically find all camelcase matches to anything we multi-select and link those together in the duplication.

    Now select the block we want to duplicate (tip - for even faster selections, use Selection Increase)…

    SelectPreMultiSelectSDS

    Press Shift+Enter

    DulicatedXaml

    And now enter the new text for the label: “Installation”.

    SDS - Installation

    Done.

    Ready to create another StackPanel/TextBlock set of controls for the “Registration” part of the spec? We’re already inside a text field, so we can press Shift+Enter to repeat the last duplication:

    SDSXamlThird

    Enter the label text: “Registration” and press Shift+Enter again, then enter “Configuration” and press Enter because we’re done.

    Our interface now looks like this:

    UI - finished SDS

    And it includes four properly-named TextBlocks (tbDownload, tbInstallation, tbRegistration, and tbConfiguration) that we can easily access from code-behind.

    You can also use SDS to duplicate CSS styles, HTML controls, parameters in method declarations, binary expressions, arguments, string constants and entire method blocks.

    SDS will also remember changes you make in each file and suggest those same changes in similar duplications you perform in the same file.

    You can also now dismiss all text fields by pressing the Esc key. This is especially useful for Smart Duplicate Selection because it may generate many text fields on the first duplication, and you can press Escape before or after you’ve modified the fields you need to change.

    That’s the killer feature in this release, and we hope you find it as useful as we do. Let us know what you think and how we can make it even better.

    Code Formatting

    Earlier versions of the code wrap option would move the entire expression to the next line if any part of it exceeded the margin. The new Simple Wrap formatting option allows you to wrap only those parts of the expression that exceed the margin, performing a non-greedy wrapping and in some cases reducing the number of lines needed to see the code.

    SimpleWrap

    Unit Testing

    • You can now run unit tests under SciTech Software’s .NET Memory Profiler. If this third-party product is installed, you can use the Run Under Memory Profiler option to run tests designed to identify memory leaks and other memory usage issues. Note: support for the CodeRush Test Runner is included with the .NET Memory Profiler versions 5.6 and up.
    • CodeRush Test Runner now supports running tests created for the F# language.

    Code Analysis

    CodeRush Analyzers now appear in the Code Issues Catalog. You can use this options page for the following tasks:

    • Enable/disable specific Code Issues.
    • Add/remove Code Issues to/from Visual Studio’s background analysis.
    • Specify the severity of each Code Issue.

    CodeIssuesCatalog

    Region Creation

    CodeRush Classic’s Region Creation feature is now available in CodeRush. Use the Ctrl+3 shortcut to create a region around the current member or selection instantly.

    RegionCreation

    C# 7 Syntax Support

    We are supporting С# 7 syntax in CodeRush features that generate exception-throwing statements (like Throw Exceptions Contract).

    Now these CodeRush features generate the specified throw-expression operation if the corresponding preference is set in the Visual Studio settings.

    ThrowExpression

    Give CodeRush a Try!

    Download CodeRush from the Visual Studio Marketplace.

    Every 30-day sprint we work hard to make CodeRush the best it can be. Let us know how we’re doing, and what we can do to make CodeRush even better for the way you develop.

  • CodeRush 17.2.5 is Available

    Another 30 days, another CodeRush release. Download the latest version from the Visual Studio Marketplace. This update contains the following enhancements:

    Code Style

    • You can now change the default visibility modifier CodeRush uses for generated members.

      17.2.5-DefaultScope
      This setting is used by Declaration Providers, Templates and other features that generate new members from scratch.
    • There's a new Code Style option that lets you set preferences for adding clarifying (but optional) parentheses to your code.

      17.2.5-OptionalParentheses

      You can apply these Code Styles with the Code Cleanup feature.

      17.2.5-OptionalParenthesisCleanup

    Templates

    • Now you can create new templates based on existing templates. Just right-click the template you want to duplicate (in the Templates options page), and select "Create Duplicate". Enter a new template name, and change the expansion or context as needed.

      17.2.5-TemplatesDup
    • Now you can easily insert template aliases into your existing templates (allowing templates to insert the contents of the aliased templates into the editor when they expand). Inside the Template Editor, just right-click and choose "Insert Alias...", then specify the name of the template to include. This is useful for sharing the same code expansion between two or more templates.

      17.2.5-TemplatesAlias|
    • You can now easily include any type in the CodeRush templates system as a Template Name Variable. Just right-click the type anywhere it appears in the Visual Studio editor and choose “Use Type in Templates...”.

      17.2.5-UseTypeInTemplates

      After selecting Use Type in Templates..., CodeRush asks for the shortcut mnemonic to use for the type.

      17.2.5-UseTypeInTemplates2

      After adding the new type, it will instantly become available in all type-aware templates, including declaration verbs like "m" (for methods), "p" (for properties), "q" for constants, "t" (for types) and "v" (for variables).
    • We have improved support for new language features in templates and other context-aware features by adding the [InInterpolatedString] context and adding the language version parameter to the [InVisualBasic(version)] and [InCSharp(version)] contexts.

    Try It Today!

    Download CodeRush from the Visual Studio Marketplace and let us know what you think. Updates every 30 days. The latest What’s New is always here.

  • CodeRush 17.2.4 is Available for Visual Studio

    Another 30 days, another CodeRush release. In this release, what used to be called “CodeRush for Roslyn” (which works in Visual Studio 2015 and up) is now known simply as CodeRush.  If you’re working in earlier versions of Visual Studio CodeRush Classic is still available and supported.

    CodeRush has a new product icon, which looks like this:

    CoreRushIcon128x128
    The new CodeRush icon.

    And we have a new product logo text, which looks like this:

    CodeRush640

    Here’s what’s new in this latest sprint:

    XML Support

    The following features are now available in XML:

    XMLFeatures

    Visualization Tools

    The Right Margin Line can help you keep code lines from getting too long or exceeding style guidelines. The margin serves as a visual indicator showing lines that have overrun the specified line length.

    RightMargin

    You can enable the right margin line using the new button (on the CodeRush Visualize toolbar) and configure it in the CodeRush Options dialog on the Editor | All Languages | Right Margin Line page.

    RightMarginToolbar

    Code Analysis

    With Code Metrics you can now establish a Threshold value that determines when the metric appears and when/if the metric contributes to code analysis. This option allows code analysis to report type members that exceed your specified complexity thresholds.

    CodeMetrics

    Code Formatting

    C# Document Formatting adds the following options:

    • Wrapping and Spacing configuration for the “??” operator.
    • Wrapping and Spacing configuration for the base types list.
    • Wrapping and Spacing configuration for the constructor initializer.
      FormattingConstructor
    • Excessive Line Breaks Removal.
      FormattingLineBreaks
    • Separate Line Break configuration options before “else”, “while”, “catch” and “finally” keywords.

    Navigation

    • The filtering dialog now has “Select All/None” switches for Scope, Types, Members and Access.
    • The filtering dialog also gains the ability to quickly reverse a filter (Shift+filter key selects/deselects all but the filter element associated with that key).

    NavFilter

    • CodeRush 17.1.9 is Now Available

      CodeRush 17.1.9 is now available, adding support for source code & XAML formatting, Microsoft Fakes support, and we have improved the unused member de-emphasis experience.

      Code Formatting

      The Code Formatting feature now includes new (beta) abilities to configure Line Breaks. Two new options pages have been added:

      Editor | C# | Formatting | Blank Lines — enables you to configure the number of blank lines around and within the following code elements:

      • Namespaces
      • Types
      • Methods
      • Properties
      • Fields

      Editor | C# | Formatting | Braces — enables you to configure the line breaks around and within the following code blocks:

      • Namespaces
      • Types
      • Methods
      • Properties
      • Accessors
      • Lambda Expressions and Anonymous Methods
      • Statements


      Code Formatting styles are applied using the Code Cleanup feature.

      XAML Formatting

      We have added an ability to normalize whitespace inside XML comments.

      XAML_Whitespace

      Unit Testing

      • CodeRush Test Runner now supports the Microsoft Fakes isolation framework.

        It helps you mock the code you are testing by replacing parts of your application with the small pieces of code under the control of your tests.


        Note: Microsoft Fakes framework is available only in the Enterprise version of Visual Studio.

      • The Code Coverage filtering has been improved. You can now filter the report, not only by name and percentage, but also by node kind.

        For example, you can create a filter that only shows methods with test coverage between 1% and 40%, like this:

        CoderageFilter

      Code Analysis

      We have improved the Highlight Unused Members experience so that member de-emphasis is temporarily disabled when the caret is inside the member.

      Thanks For Your Support!

      You can always download CodeRush for Roslyn from the Visual Studio Marketplace.

      If you’re already using CodeRush for Roslyn and enjoying it, please share a review with other Visual Studio developers!

    • CodeRush for Roslyn 17.1.8 is Available

      Another 30 days, another release of CodeRush for Roslyn. This release brings improvements in .NET Core 2.0 support, code formatting, code analysis, code providers, and templates.

      .NET Core 2.0 Support

      The Unit Test Runner now runs .NET Core 2.0 tests and can calculate Code Coverage in Portable PDB debug-symbols-format projects. Also, the Unit Test Runner gets a performance boost when running .NET Core tests.

      Code Formatting

      We have added a new code formatting feature that controls spacing options in your code. Now you can add or omit spaces around virtually every part of code, with more formatting options available than what you get with Visual Studio alone. Spacing style code formatting rules are applied with the Code Cleanup feature.

      Formatting_Spaces

      We have also improved XAML formatting, adding the ability to format markup extensions. You can now control the following options:

      • Break arguments apart only if the argument count for an element exceeds a specified count.
      • Align markup extension arguments with first argument.


      Code Analysis

      This release includes a preview of a new feature we’ve been working on, NullReferenceException Analysis. This feature identifies unprotected code that may unintentionally raise NullReferenceExceptions.

      Null-reference exceptions are often thrown in unexpected, edge-case scenarios, and can easily remain undetected even after publishing your software. These code defects are challenging to find and are often discovered by customers after the application has shipped.

      CodeRush for Roslyn now identifies code that may be prone to throwing a NullReferenceException. You can turn this feature on for C# (it is disabled by default) on the Editor | All Languages | Static Code Analysis options page:

      NullRefSearch

      Turn this feature on and let us know what you think.

      Refactorings and Code Providers

      We have added a new Add XML Comments code provider, which lets you instantly add new XML doc comments to members.

      If you use Add XML Comments for a member that is an override or an interface implementation, the XML doc comment is based on the documentation found in the interface or ancestor class. If the target method has no base method or its base method or interface declaration has no XML comment, the code provider generates an empty XML comment with the correct structure.

      Local Function Templates

      Templates for creating methods are now available inside members in C# (for C# version 7 and above) to create local functions:

      LocalFunctionTemplates

      For more information on using templates to create methods and write code quickly, see the M for Methods video in the CodeRush Feature of the Week series.

      ClickToWatch_0C42A107

      Thanks For Your Support!

      You can always download CodeRush for Roslyn from the Visual Studio Marketplace.

      If you’re already using CodeRush for Roslyn and enjoying it, please share a review with other Visual Studio developers!

    • CodeRush 17.1.7 Released

      This release of CodeRush for Roslyn, our Visual Studio productivity boosting add-in includes enhancements to code coverage, code analysis, and more. This release also includes a preview release of project-wide code cleanup.

      Code Coverage

      You can now exclude specific projects from Code Coverage analysis using the *.runsettings file. For details refer to Microsoft’s article, Customizing Code Coverage Analysis.

      ExcludeFromCoverage

      You can now create and apply Filters to the Code Coverage report. For example, you can create a filter that only shows members with less than 70% coverage.

      FilterCoverage

      Code Analysis - Unused Members

      We have added a new analyzer that detects unused members.

      HighlightUnused

      You can also configure unused member highlighting in the CodeRush options dialog (Editor | All Languages | Static Code Analysis | Highlight unused members).

      HighlightUnused2

      Unused members can be safely deleted without changing program behavior.

      Refactorings and Code Providers

      The Use string.Format refactoring is now available on interpolated strings.

      Project-wide Code Cleanup (Preview)

      You can now run Code Cleanup for the entire project. Simply right-click the project you want to clean in the Solution Explorer and select Cleanup Project from the context menu.

      CleanupProject1

      As CodeRush cleans the project, a window shows progress.

      CleanupProject

      If code cleanup is cancelled, all code files will remain unchanged.

      Reminder: This feature is in a preview state, and may break or change the behavior of your code. If you find Code Cleanup yields unexpected results, please let us know. You can globally undo the entire operation using the Visual Studio’s Undo action (available when any document changed by code cleanup is open).

      Download CodeRush for Roslyn from the Visual Studio Marketplace.

    • How Visual Studio’s Private Gallery Helps Us Create a Better Product

      When we started working on CodeRush for Roslyn, we realized we needed a convenient way to deliver updates to our customers.

      We knew that Visual Studio already provided a great tool for extension developers - the Extensions Gallery on the Visual Studio Marketplace. This public repository makes it easy to deliver polished updates to the world, but we also wanted internal developers using CodeRush for Roslyn to have the same experience in their daily work. We wanted to make it as easy for them to participate in beta testing and getting new beta updates as it is for customers to get new releases of CodeRush: Automatically.

      Fortunately the Visual Studio Extensions Gallery lets us add a private source for extensions, which can be used to deliver updates for a selected group of beta testers.

      I’d like to share our experiences with the Private Gallery and show how we found it to be an effective tool in creating better products for customers.

      Daily Builds

      When you are working in an agile environment, it is crucial to have a rapid update cadence and a stable channel to reliably deliver those updates to testers, internal users, and customers.

      In building our products at DevExpress, we use an internal build farm that executes the entirety of the test and build process automatically, running on dedicated hardware. This allows developers to remotely generate new builds in a matter of minutes. Once a build is ready, we can distribute that build using the Private Gallery. This combination of dedicated build farm plus effortless & precisely-targeted distribution allows us to easily provide updates for our beta testers daily, or more frequently if needed.

      Quality Assurance

      This workflow is indeed fast with barely a hit on resources, but what about quality? Since our developers are constantly pushing code out to our development branch through version control, we must take preventative steps to ensure that new code doesn’t break existing features before giving it to our testers. And since CodeRush is an extension to Visual Studio, our beta testers are also using it to create production code. So every beta we ship has to be solid. For us, we found having a comprehensive suite of unit and integration test cases goes a long way in ensuring solid builds. If one test case fails, the build farm doesn’t allow an upload to the Private Gallery.

      So what does a comprehensive testing suite look like? For us, that means about 36,000 unit tests, which thoroughly covers about 75% of our code. We also have nearly 500 full-blown integration tests, which start instances of Visual Studio and ensure CodeRush for Roslyn properly loads, MEF composition binds as expected, and integrated features are operating correctly.

      Having a comprehensive suite of tests is essential to being able to deliver high-quality daily builds to your testers. It is so important, that it has changed how we work. For example, developers on our team are not allowed to check in any new features without also checking in supporting test cases to prove the code works as expected (and that it doesn’t work in unexpected ways). And developers are not allowed to submit bug fixes without also submitting new test cases proving that the fix works.

      So we definitely consider our test suite to be a valuable company asset, one that every developer continues to invest in as we move forward.

      Setting up the Private Gallery

      The first step in setting up a Private Gallery is to specify which URLs Visual Studio will use to download details about any updated extensions.

      To do this, open the Options window using the Tools | Options menu, then navigate to Environment | Extensions and Updates options page. To the right of the Additional Extension Galleries list box, click the Add button, then specify name and URL for the Private Gallery:

      AdditionalExtensionGalleries

      In the example above, we’ve named our gallery “Custom Gallery” and specified http://localhost:5000/custom.xml as the URL.

      Click OK to close the Options dialog.

      Now, if you bring up the Extensions and Updates dialog, and open the Online category, Visual Studio will show our new Private Gallery:

      NewPrivateGalleryAppears

      Unfortunately, if you try to use it right now, Visual Studio will likely complain about its inability to connect to the remote server. Don’t worry. This is expected at this point because we also need to setup a server to supply an Atom Feed file for the extensions we want to distribute.

      The Atom Feed File

      The Atom Feed file is an XML file containing a list of all the extensions available in the gallery. Each entry in the list includes essential information, such as extension ID, version details, author, etc. Official documentation on Atom Feed files already exists in the Atom Feed for a Private Gallery article, so we won’t dive into the details and structure here. However, we will show you how we dealt with the hardest part: generating and updating this file.

      Check out the code in this project which updates the Atom Feed file each time you build and publish your extension. It is a console application expecting two command line parameters: the VSIX file path and the destination folder to be served by an HTTP(s) server. For example, you might add a call like this to the UpdateAtomFeed application inside your build script:

      UpdateAtomFeed.exe "C:\Builds\TestExtension.vsix" "C:\GalleryServer\wwwroot"

       
      The UpdateAtomFeed application copies the VSIX file to the specified server folder, then extracts the VSIX information and creates a custom.xml Atom Feed file (or updates an existing Atom Feed file if found).

      A Simple .NET Core Atom Feed Server

      Both the Atom Feed file and your VSIX files need to be hosted on a server available to your network, so let’s create a small .NET Core server application that does just that.

      Start by creating a new .NET Core console application and name it “GalleryServer”. Then add the following NuGet dependencies:

      • Microsoft.AspNetCore
      • Microsoft.AspNetCore.Hosting
      • Microsoft.AspNetCore.StaticFiles


      Next, add the following code which creates and configures our static file server:

      using System.IO;     
      using Microsoft.AspNetCore.Hosting;  
      using Microsoft.AspNetCore.Builder;  
      using Microsoft.AspNetCore.StaticFiles; namespace GalleryServer {
          public class Startup {
              public void Configure(IApplicationBuilder app) {
                  var provider = new FileExtensionContentTypeProvider();
                  provider.Mappings[".vsix"] = "application/vsix";
                 
                  app.UseStaticFiles(new StaticFileOptions() {
                      ContentTypeProvider = provider
                  });
              }
              public static void Main(string[] args) {
                  string path = Directory.GetCurrentDirectory();
                  string wwwRootPath = Path.Combine(path, "wwwroot");
                  new WebHostBuilder()
                      .UseKestrel()
                      .UseWebRoot(wwwRootPath)
                      .UseContentRoot(wwwRootPath)
                      .UseStartup<Startup>()
                      .Build()
                      .Run();
              }
          }
      }

      This console app listens to the  http://localhost:5000 address and starts serving static files from wwwroot folder:

      ListeningLocalHost

      Note that in the code we have also specified a FileExtensionContentTypeProvider and registered the .vsix extension mapping as an application/vsix MIME type. This is necessary to serve VSIX files, because VSIX is not one of the standard file types.

      Now when you open Tools and Extensions, Visual Studio should reveal our new test extension:

      NewTestExtension

      Nice. And now we can now use our Private Gallery to easily install & update new builds of this extension.

      Of course, we also need to allow connections from outside our local host, so the gallery becomes available to users outside our network. On Windows we can use IIS to accomplish this.

      Wrapping Up

      For us, the benefits of agile development are amplified when the edit/compile/test/build/distribute/feedback cycles are short. Thanks to Visual Studio’s Private Gallery options, along with our build farm and comprehensive test cases to ensure product quality, we were able to shrink that typical feedback loop (which can lumber on for days, distracting valuable resources) down to a cycle measured in just a few hours and with very little impact on existing resources.

      Full source code and samples are here.

      Written by Alex Zakharov & Mark Miller

    • CodeRush for Roslyn, Version 17.1.6, is Available

      This month’s release of CodeRush for Roslyn adds new code formatting options, expands the capabilities of the source code spell checker, improves the ForEach to Linq refactoring, and ports over a useful organizational feature from CodeRush Classic.

      New Code Wrapping Rules

      New formatting rules let you specify exactly how you would like to align code when it needs to wrap across multiple lines. Just specify the right margin column, and then decide what to wrap and how those wrapped lines will line up.

      17.1.6-Wrapping

      Check out the before & after previews in the screenshot above to get a sense of how cool this is.

      This is a great feature, and an easy way to improve the code readability. You can create custom wrapping rules for a wide range of expressions and initializers.

      Formatting options are applied through the Format Document rule, which can be included as part of CodeRush’s Code Cleanup feature. You can specify which rules to apply on the Code Cleanup options page:

      17.1.6-wrapping-cleanup

      Spell Checker

      The CodeRush Spell Checker gets an update. In this release we can now:

      • Check XML comments (<c> and <code> tags are ignored).
      • Check File Names.
      • Exclude ToString() expressions.
      • Properly handle Microsoft.Naming suppressions. The Spell Checker now ignores words suppressed using the SuppressMessage attribute.
         

      We have also added a new toolbar button to toggle the Spell Checker on and off.

      17.1.6-SpellChecker

      Code Style

      Now you can set your preferred order for member modifiers keywords (“static”, “public”, “virtual”, etc.). CodeRush for Roslyn features will maintain this order when adding or removing modifiers. For instance, you can set public and private modifiers to be placed before the static modifier. This feature is available for C# only, as Visual Studio automatically sorts modifiers in Visual Basic.

      We are also synchronizing the following Code Style settings with similar code style settings found in Visual Studio:

      • Local Declaration Style
      • Built-in Type Names
      • this/Me Qualifier Usage

      If you change any of these settings in Visual Studio, the corresponding settings in CodeRush will be updated to match your changes. If you subsequently change the CodeRush settings, that will not alter the Visual Studio settings.

      And we have added the new Attribute List Code Style & Code Cleanup rule, allowing you to combine two or more attributes when they are applied to a single member.

      17.1.6-AttributeList

      See the before & after previews in the screenshot above to see an example.
       

      Improved Refactoring

      We have improved the ForEach to Linq refactoring so it generates cleaner code in more complex cases. The following Linq functions are now nicely supported by the query generator:

      • Aggregate
      • All
      • Any
      • Cast
      • Count
      • Distinct
      • FirstOrDefault
      • LastOrDefault
      • Select
      • Where

      Move Member to Region

      We have ported the Move Member to Region feature from CodeRush Classic. You can now create regions and move members to them easily. Simply click a member icon, select Move To Region and choose the target region.

      17.1.6-MoveToRegion

      Thanks For Your Support!

      You can always download CodeRush for Roslyn from the Visual Studio Marketplace.

      If you’re already using CodeRush for Roslyn and enjoying it, please share a review with other Visual Studio developers!

    1
    2 3 4 5 6 7 8 9 10
    LIVE CHAT

    Chat is one of the many ways you can contact members of the DevExpress Team.
    We are available Monday-Friday between 7:30am and 4:30pm Pacific Time.

    If you need additional product information, write to us at info@devexpress.com or call us at +1 (818) 844-3383

    FOLLOW US

    DevExpress engineers feature-complete Presentation Controls, IDE Productivity Tools, Business Application Frameworks, and Reporting Systems for Visual Studio, Delphi, HTML5 or iOS & Android development. Whether using WPF, ASP.NET, WinForms, HTML5 or Windows 10, DevExpress tools help you build and deliver your best in the shortest time possible.

    Copyright © 1998-2018 Developer Express Inc.
    All trademarks or registered trademarks are property of their respective owners