Git for .NET Developers – DevBoston User Group

Slides: Git for .NET Developers

Links

  • Git Project Home: Info and reference materials
  • GitHub: Popular hosting for Git projects with free public repos or private repos with paid accounts. Get the GitHub for Windows client from here or use the GitHub plugin in Visual Studio 2015 RC.
  • Visual Studio Online: Online TFS with Git as a source control option. Free accounts with unlimited private repos all integrated with the rest of the TFS tool suite.
  • Brian Harry wrote a blog post about TFVC vs Git feature support in TFS that might be helpful when deciding which source control option to choose for a TFS project.
  • BitBucket: Alternative to GitHub. You can also get the SourceTree tool that we looked at from here.

(more…)

Read More

Changes to Visual Studio 2015 XAML debugging tools in RC

XAML Debugging Tools in Review

In my last review of the new Visual Studio 2015 XAML debugging tools (xaml-debugging-tools-vs-snoop) I found a lot to like but a few key shortcomings compared to what has been available in Snoop.

Now that the Release Candidate of Visual Studio 2015 has been released the tools are farther along and closer to what their final state will be at RTM. So how are things progressing? Pretty well!

Most of the key features I identified last time are the same but getting more polished overall. Most of the new changes are in the Live Property Explorer.

Property Explorer in VS 2015 RC

(more…)

Read More

Enable Developer Mode for Windows 10 Technical Preview

The new Windows 10 Technical Preview released last week (Build 10074) along with the Release Candidate of Visual Studio 2015 should finally allow a larger set of developers to start writing Universal Apps for Windows 10. One of the first things developers are likely to run into when they try to test a Universal App is an error message instructing them to “Enable Developer Mode” through the Windows Settings application. Unfortunately this part of Settings isn’t included in Build 10074.

To allow deployment of apps from Visual Studio you need to use an alternative procedure to change some Group Policy options. Start by running Gpedit.msc (as administrator). Locate “App Package Deployment” under Local Computer Policy-Computer Configuration-Administrative Templates-Windows Components:

Group Policies for Windows 10 Developer Mode

(more…)

Read More

Visual Studio 2015 XAML debugging tools from a Snoop perspective

*Update for new RC features: http://codemindinterface.com/2015/05/changes-to-visual-studio-2015-xaml-debugging-tools-in-rc/

Anyone who has done a significant amount of work in WPF is probably familiar with XAML debugging tools like Snoop. A few other tools have come along since with similar functionality that also works across different XAML platforms, but for WPF Snoop still packs a punch. Finally, after almost a decade, Visual Studio is getting the kind of visual tree debugging that’s been an essential part of XAML development (and it will work on all XAML platforms). But given that the tools are brand new (actually still in pre-release, CTP6, as of now) and live inside VS itself rather than a standalone app, how do they stack up? (more…)

Read More

Roslyn and the future of .NET languages – Language Features

Boston Code Camp 22 materials: Slides | Language Features Demo Code | Post on Extensions

The new Visual Studio 2015 Roslyn language features include a grab bag of nice changes to help make code more compact and readable. This isn’t an exhaustive list but some of my favorites.

Getter only and initialized auto-properties

public string Name { get; } = "John";

This is a much simplified way to create readonly properties, which previously required a full property with a backing field declared as readonly. This is not the same as an auto-prop with a private setter, which is still a mutable value. The value can be set from a constructor or in line since auto-properties can also now be initialized directly.

Null conditional operator ?.

NameSize = Name?.Length.ToString() ?? "0";

This is going to be great for cutting down on surprise NullReferenceExceptions and is so much more compact than a string of if statement checks.

Interpolated Strings

Console.WriteLine($"User name is {Name}");

Finally, the functionality of String.Format has some readable syntax! In the current VS Preview the syntax uses "\{Expression}" but this will change to use the $ syntax before release.

Expression bodied members (C# only)

public int CountMultiple(int multiplier) => Count * multiplier;

This is mostly just cutting down on space required for these declarations.

await in catch and finally blocks (C# only)

try
{
    await operation.DoWork();
}
catch
{
    await operation.Rollback();
}
finally
{
    await operation.Close();
}

One of those seemingly simple things that could stop you in your tracks if you were in a situation that needed it in C# 5 and needed a lot of extra code to work around.

Read-write properties to implement Read-only interface properties (new in VB)

Public Interface IHaveData
    ReadOnly Property Name As String
End Interface

Public Class ClassDemo
    Implements IHaveData
    Public Property Name
        Get
            Return ""
        End Get
        Set(value)

        End Set
    End Property
End Class

Another one that’s so simple but could really get in the way when it wasn’t available.

 

Download the Visual Studio 2015 Preview: http://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs

Check out the full list of new language features and latest updates (and the source code!) on CodePlex: http://roslyn.codeplex.com/wikipage?title=Language%20feature%20status&referringTitle=Home

Read More

Roslyn and the future of .NET languages – Extensions

Boston Code Camp 22 materials: Slides | Extension Demo Code | Post on Language Features

With the new code editors in Visual Studio 2015 now written around the Roslyn compiler a whole new level of extensibility is available both for built in features and user created extensions. If you’ve worked with Visual Studio extensibility before a Roslyn extension can a big improvement both in ease of coding and end user experience.

New Refactorings

Refactoring support was added in Visual Studio 2005 and since then a grand total of 0 new ones have been added. Now two new ones have been added to allow introducing new variables and for inlining existing ones. The experience is much improved for all the existing refactorings too.

New Refactoring Experience in 2015

Diagnostics and Code Fixes

Normal compiler errors show up in the editor as you type but can also be augmented with additional diagnostic checks performed by other Roslyn extensions. One key example is a large portion of the existing FxCop Code Analysis rules which were previously run as an additional build step but now happen on the fly as you type, making it much easier to apply these rules right away and keep your code cleaner from the start.

Unlike with normal compiler warnings or errors that you would normally get with FxCop, many of the new diagnostics include an additional component to actually correct the problem for you when possible, even showing a preview of the changes right in line (just like Refactorings).

Write your own!

Visual Studio has been extensible for a long time but there have been major limitations on how deep an extension could get into the code without writing your own compiler. In 2015, a Roslyn extension can take advantage of deep knowledge of the code in real time through the compiler as a service. Project templates are available that make it easy to set up either a Refactoring or a Diagnostic with (or without) a Code Fix. Deployment can be done either through a VSIX that can go up on Visual Studio Gallery, or now as part of a NuGet package that can be deployed on a project by project basis. The possibilities are endless and I expect a huge flood of Roslyn extensions are going to be available on top of what’s already been added into the product.

 

Download Visual Studio 2015 Preview and the SDK: http://www.visualstudio.com/en-us/downloads/visual-studio-2015-downloads-vs

Roslyn templates Visual Studio extension: https://visualstudiogallery.msdn.microsoft.com/849f3ab1-05cf-4682-b4af-ef995e2aa1a5

Bill Wagner announcing a new central location for community Roslyn extensions: http://thebillwagner.com/blog/announcing-dotnetanalyzers-diagnostics-and-code-fix-open-source-projects

Read More

Digesting the flood of announcements from Visual Studio Connect()

Day 1 of the Visual Studio Connect() event today was packed with announcements, some of which are pretty dramatic changes to the Microsoft development landscape.

The obvious headline announcement which everyone is talking about (and will likely continue to) is the Open Sourcing and Mac/Linux support for the .NET Core Framework. This, along with the NuGet deployment mechanism for app-local copies of the framework, are going to be a huge shift in how .NET apps are developed, deployed, and run on the server. News and commentary is all over the web but Scott Gu’s blog post is a good place to start.

Probably my favorite news of the day was WPF finally emerging from hibernation. The platform is moving forward with fixes to reported issues and general improvements to the platform. Even more exciting, the tooling is getting some long needed attention: visual tree debugging a la Snoop, performance analysis tools, a full refresh of Blend, and a commitment to keep moving the tooling forward for all of the XAML platforms. Read the full roadmap blog post for all the details.

Some of the other under-the-radar announcements came on the Visual Studio side. The integration of MS Research’s Pex project as the new Smart Unit Tests feature should be an interesting addition and is a feature I expect to grow over time into a really powerful code validation tool. Although Roslyn has been out in the wild in CTP form for a while now, the IDE features around it are really starting to come together in the newly released 2015 Preview. Already in this preview a lot of CodeRush/Resharper-like features have been added and the extensibility model is so much better than it has been in the past that I expect community contributions of new code validation and refactoring features to explode over the next few months. My biggest concern at this point is actually around how to manage large sets of these extensions as I don’t think it would be out of the question to end up installing 100+ on top of the built in functionality. Check out details on what’s in the preview and go try it out!

Read More