Quantcast
Channel: Visual Studio Blog
Viewing all 1039 articles
Browse latest View live

Snapshots on Exceptions while debugging with IntelliTrace

$
0
0

Have you ever encountered an exception in your application while debugging, and wanted to know exactly what the state of the app was at that point in time? Or, you’re debugging async code and you want to know the context in which an exception was thrown? Now, with a new feature in IntelliTrace step-back, you can!

Starting in Visual Studio Enterprise 2017 version 15.7, IntelliTrace will now automatically take snapshots on exception events, in addition to breakpoints and debugger steps. This enables you to go back to a previous exception event and see the state of the application at the time the exception was thrown.

Exception events are the most widely used IntelliTrace event, and we’re excited to be able to address a top customer ask.

Enabling snapshots on exception events

To enable this feature, go to Tools -> Options -> IntelliTrace settings, and select the option “IntelliTrace events and snapshots.” By default, IntelliTrace will collect a maximum of five snapshots on exception events between break states – e.g. between debugger steps or breakpoints. This number can be configured in IntelliTrace advanced settings.

Enable this feature in Tools - Options - IntelliTrace by selecting "IntelliTrace events and snapshots"

Debugging with snapshots on exceptions

Let’s walk through an example of how we can use this feature while debugging an application.

In my shuttle application, I see that when I F5 to debug it, I get an error. The driver details are not appearing as expected.

The driver details and headshot picture does not show as expected

In Visual Studio, IntelliTrace has recorded an exception event in the Diagnostic Tools window. The camera icon indicates that there is a snapshot available.

Camera icon on the Exception indicates there is a snapshot available

To view the snapshot, double-click on the event, or select the event and click the ‘Activate Historical Debugging’ link.

Visual Studio is now in Historical Debugging mode at the line of code where the exception was thrown.

Visual Studio is in historical debugging mode

From here, you’ll be able to see the historical values of your Call Stack, Locals, and Watches, just as you would in regular, live debugging. You can also evaluate expressions in the Watch Window and hover over variables to see data tips. All these values are populated using the data from the snapshot.

Using this information, I can see from the Locals window that the exact value of driver.name was null. In this query, we should have done the comparison on driver.id.

By changing the query to in line 161 to:

selectedDriver = drivers.Where(d => driver.id.Equals(d.DriverId)).FirstOrDefault();

the issue is fixed. Now, the driver shows up!

The issue is fixed and now the driver headshot picture shows

To minimize redundant snapshots and improve performance, IntelliTrace will only take snapshots on exception ‘thrown’ events under certain conditions. The first time an exception is thrown, IntelliTrace will take a snapshot and mark it accordingly. If this exception is caught and then rethrown or wrapped as an inner exception to another thrown exception – no snapshot will be taken on these events, nor any exception events associated with the original exception. Additionally, IntelliTrace will not take snapshots on exceptions with the same type and call stack as an existing exception event that already has a snapshot.

Try it out

The IntelliTrace snapshots on exceptions feature is available in Visual Studio Enterprise 2017 version 15.7 and requires Windows 10 Anniversary Update or above. The feature is currently supported for ASP.NET, ASP.NET Core, .NET Core, WinForms, WPF, managed console apps, and managed class libraries.

We’d love to hear your feedback. To report issues, use the Report a Problem tool in Visual Studio. You’ll be able to track your issues in the Visual Studio Developer Community where you can ask questions and find answers. You can also make a product suggestion through UserVoice, or email the team directly at stepback@microsoft.com.

Deborah Chen, Program Manager, Visual Studio Diagnostics
@ChenDeborah

Deborah is a program manager on the Visual Studio Diagnostics team, working on IntelliTrace.


New Updates for Azure Development in Visual Studio

$
0
0

With Microsoft Build 2018 in the books, we just released a series of updates to Visual Studio for Azure Development. This improves productivity and security for developers building and diagnosing web applications, containers and microservices. To help you make the most of these new advancements for developing in the Azure cloud, we’ve compiled a “best of” list announced at this year’s event.

Web App Development

We improved Web publish by adding App Service Linux as a target. This allows you to build a .NET Core app and easily publish it to App Service running on native Linux, unlike today where you must build custom containers to deploy on Linux.

As a part of this publish flow you will see that Azure Web Apps and Functions allow you to create storage accounts as a part of the experience. This is helpful when your web apps or functions leverage storage accounts as a way to trigger events based off of actions in Storage, or if you’re interested in storing information in the cloud rather than within your application.

For those developing cross-platform applications, we’ve also made improvements to the publish flow of ASP.NET Core applications. You can now configure your ASP.NET Core application to publish as a standalone app, and change from release to debug prior to publishing.

To help you diagnose and address issues with your code, we added new features for the Application Insights Profiler and Snapshot Debugger. It is now easier to enable these features without requiring a redeploy, run the profiler on-demand, and get a snapshot health check to identify reasons for missing a snapshot. You also have more entry points for accessing the debugger from within Visual Studio. For example, you can launch the Snapshot Debugger inside Visual Studio from the Debug -> Attach Snapshot Debugger menu.

Connecting your code with the cloud

When you’re first starting with your application, it can be hard to figure out all the ways you can connect Azure services with your solution. Connected Services is a Visual Studio experience that allows you to easily integrate your code with Azure services, even provisioning them if necessary. This experience has added support for three more Azure offerings in addition to existing ones:

Containers & Microservices

Support for containers keeps growing with new and updated features for building cloud-native applications with microservices and containers. The “Add Docker Support” functionality has been simplified starting with Visual Studio 2017 version 15.8 preview 1. Now, when you add docker support to an ASP.NET Core web application, Visual Studio will create a docker file for you, without a separate docker compose project. You can still debug your application inside a Docker container or publish to Azure App Service for Containers or Azure Container Registry, just as before.

If you wish to add docker compose support to your project, you can use the new “Add Container Orchestration” option on the project’s context menu. This will allow you to choose between different Orchestration options, such as Service Fabric. We’re also excited to announce the private preview of tools for publishing your application to Kubernetes. Once you have the private preview tooling installed, the “Add Container Orchestration” option will also allow you to add the appropriate files for running your application in Kubernetes, including a Dockerfile as well as Helm charts. In addition, you’ll see a new option for publishing directly to Azure Kubernetes Service. If you’re interested in trying out the private preview, sign up for the private preview here.

Whatever option you choose for your orchestrator, you also get additional features if you’re storing your base images in Azure Container Registries, as support for geo-replication is now generally available. This feature helps safeguard your images by making sure they’re cloned to other data centers, so you don’t have to worry about the images becoming unavailable.

If you’re interested in building microservices with the reliability, mission-critical performance and scale of Service Fabric, but without cluster management and patching operations, you now have the option of using Azure Service Fabric Mesh, which is in private preview, with a public preview becoming available in coming weeks.

Storage Explorer

Although not part of Visual Studio, Storage Explorer is an integral tool for examining the contents of your storage accounts and other storage resources. Storage Explorer is now generally available, with the latest update including an improved sign-in experience and increased accessibility support.

If you’re interested in getting base applications to test out any of these updates, you can download a sample from our revamped Azure samples page.

Lastly, moving applications to the cloud in order to take advantage of all the benefits of Azure services is a major undertaking for some companies, but it can be hard to navigate this process. You can learn more about it by listening to our guest spot on this podcast about lifting and shifting applications to the cloud.

We hope you enjoy these developer features! We look forward to seeing your feedback on them. In the meantime, you can find more information on the Azure Developer Center.

Thanks,
-The Azure Developer Experiences team

Cristy Gonzalez, Program Manager, Azure Developer Experiences

Cristy has been a PM at Microsoft since 2013. In that time, she has worked on the Azure SDK, Storage Explorer, Azure Diagnostics, and Azure developer services like DevTest Labs and ACR. She’s currently working on experiences for users getting started with Azure.

Visual Studio 2017 version 15.8 Preview 2

$
0
0

We’re happy to share the highlights of the latest Visual Studio 2017 preview, which is now available for download, including:

  • Emulator and Designer improvements when developing mobile Android apps, and Xamarin.Android support of Android P Developer Preview 1
  • C++ development improvements
  • Ability to fine-tune solution load configuration settings to maximize performance
  • Significant new functionality in the CPU Usage tool to help you profile your applications’ performance
  • Improvements to make it easier to build and debug extensions

This Preview builds upon the features that debuted in Visual Studio version 15.8 Preview 1, which was released at Microsoft Build 2018 earlier this month. As always, you can drill into the details of all of these features by exploring the Visual Studio 2017 version 15.8 Preview release notes.

We hope that you will install and use this Preview, and most importantly, share your feedback with us. To acquire the Preview, you can either install it fresh from here, update your bits directly from the Preview IDE, or if you have an Azure subscription, you can simply provision a virtual machine with this latest Preview. We appreciate your early adoption, engagement, and feedback as it helps us ship the most high-quality tools to everyone in the Visual Studio community.

And now, without further ado, I’d like to introduce the new features to you.

Mobile Development for Android

Android Emulator: This release contains a preview of the Google Android emulator that is compatible with Hyper-V, which is available in the Windows 10 April 2018 Update. This means you can use Google’s Android emulator side-by-side with other Hyper-V based technologies, including Hyper-V VMs, Docker tooling, the HoloLens emulator, and more. Developers who use Hyper-V now have access to a fast Android emulator that will always support the latest Android APIs, works with Google Play Services out of the box, and has all features of the Android emulator, including camera, geolocation, and Quick Boot.

This Visual Studio 2017 version 15.8 Preview release adds support for launching, deploying, and debugging Android apps from within Visual Studio with the new Hyper-V based emulator. For more information, visit the documentation on enabling Hyper-V based hardware acceleration in the Android emulator.

Hyper-V Emulator

Android Designer: We’d like to call your attention to a couple of improvements to the Android development experience. First, we’ve enabled the split-view editor, which allows you to create, edit, and preview your layouts at the same time.

Second, you can now inject sample placeholder data or images into your views so that you can preview how the layout would behave. Refer to the Preview release notes for additional configuration details. Both of these improvements will make you more productive as you iterate on your UI design.

Sample data example

Xamarin.Android SDK: We’re excited to announce Xamarin.Android support for Android P Developer Preview 1. Android P introduces new features including display cutout support, notification enhancements, multi-camera support, AnimatedImageDrawable and much more. Be on the look-out in future Visual Studio Previews for Xamarin.Android support of Android P Developer Preview 2 and Developer Preview 3. For more information about the release cycle of Android P Preview, read about the Android P Preview Program Overview.

C++ Development

ClangFormat: In Visual Studio 2017 version 15.8 Preview 2, we added the Add > New Item template for generating a .clang-format file following the coding convention specified for ClangFormat in Tools > Options. If the Visual Studio convention is selected, the generated file will match the user’s current Visual Studio formatting configuration from Tools > Options. In addition, we updated the shipped clang-format.exe version to 6.0.0.

Open Folder: Adding configurations to CppProperties.json is now as simple as selecting a template. Use the configuration dropdown and select the option to create a CppProperties.json from a template, or right click in the editor of CppProperties.json to add templates to existing CppProperties.json files.

CMake

Performance – Loading Solutions

By default, loading solutions automatically re-opens documents that were opened in the previous session. Sometimes, opening all of these files can cause solution loads to take a long time to complete. In Visual Studio 2017 version 15.8 Preview 2, we’ve introduced a Project and Solution config setting checkbox to give you the ability to change the default behavior regarding opening documents generated during the prior session. More information can be found here.

Performance – Profiling with the CPU Usage tool

In Visual Studio version 15.8 Preview 2 we’ve released several new features of the CPU Usage tool in the Performance Profiler.

First, the CPU Usage tool now displays asynchronous code in the Call Tree view with logical call stack stitching on by default. The feature can be controlled via the “Stitch Async Code” option in the Filter dropdown of the CPU Usage tools main view (to turn it off & on). Displaying logical call stacks for asynchronous code is helpful because asynchronous code is written with context surrounding the code, even if the actual execution is performed independently of that logical context (on its own thread, for example). Below is a screen shot of deeply nested asynchronous functions displayed with their parent context (note the ‘[Async]’ tag prepending asynchronous functions).

CPU Usage Async

The CPU Usage tool now also includes a Modules/Functions view. This view will display execution cost (sample count) by module (dll) and by function within a module. This is useful when you need to determine how much a module contributed to CPU usage in total during a profiling session. You can expand a module to see a flat list of functions from the module breaking down the usage by individual function. This can be helpful to determine where to focus attention when investigating bugs or changes that impact performance. You can display the Modules view by selecting the “View in Modules” menu command from the context menu of a function in the list of the CPU Usage tool’s main view or by selecting “Modules” from the Current View dropdown when displaying the Call Tree or Caller/Callee views of the CPU Usage tool. Below is a screen shot of the Modules view with a module expanded.

CPU Usage Modules

Finally, the CPU Usage tool now has instance indication in the CPU Usage graph displayed in the main view. Instance indication is useful to know when a function was executing during a profiling session. This makes is very easy to determine if a function was executing in a single block of time or multiple times during a profiling session. Instances are indicated via a dark (purple) line over the CPU utilization % graph in the ruler at the top of the CPU Usage tool’s main view. To view instances in the CPU Usage graph, simply double-click a function in any of the views offered by the CPU Usage tool. Below is a screen shot of the instances of a selected method when it was on the stack during the profiling session.

Note: The below screen shot displays the main view (on the right) and the Modules view (on the left) side-by-side; this configuration is most useful to avoid having to switch the views to see the instance indication when working with a child view (Modules, Call Tree, or Caller/Callee). This configuration is available by click-dragging one of the window titles out of the title bar at the top of the document area and dropping it on the desired drop target.

CPU Usage Instance

Extension Development

We’ve added some components and features to the Build Tools SKU, which means that you can now build Visual Studio extension (VSIX) projects using only the Build Tools for Visual Studio 2017. Additionally, if you have more than one instance of Visual Studio 2017 installed (like, for example, you’re using the 15.8 Preview 2 version as well as the 15.7 side-by-side Release version), then you can now select which instance to deploy your extension to when debugging. This means that you can develop your extension using the released version while debugging using the preview one.

Extension Debugger Picker

Try out the Preview today!

If you’re not familiar with Visual Studio Previews, take a moment to read the Visual Studio 2017 Release Rhythm. Remember that Visual Studio 2017 Previews can be installed side-by-side with other versions of Visual Studio and other installs of Visual Studio 2017 without adversely affecting either your machine or your productivity. Previews provide an opportunity for you to receive fixes faster and try out upcoming functionality before they become mainstream. Similarly, the Previews enable the Visual Studio engineering team to validate usage, incorporate suggestions, and detect flaws earlier in the development process. We are highly responsive to feedback coming in through the Previews and look forward to hearing from you.

Please get the Visual Studio Preview today, exercise your favorite workloads, and tell us what you think. If you have an Azure subscription, you can provision a virtual machine of this preview. You can report issues to us via the Report a Problem tool in Visual Studio or you can share a suggestion on UserVoice. You’ll be able to track your issues in the Visual Studio Developer Community where you can ask questions and find answers. You can also engage with us and other Visual Studio developers through our Visual Studio conversation in the Gitter community (requires GitHub account). Thank you for using the Visual Studio Previews.

Christine Ruana Principal Program Manager, Visual Studio

Christine is on the Visual Studio release engineering team and is responsible for making Visual Studio releases available to our customers around the world.

What’s Next for Visual Studio

$
0
0

Since we launched Visual Studio 2017 in March of that year, it has become our most popular Visual Studio release ever. Your feedback has helped our team publish seven updates since our initial GA, which have improved solution load performance, build performance, and unit test discovery performance. We’ve also made Visual Studio 2017 our most accessible releases ever, helping developers with low-vision or no-vision be more productive.

Our team is focused on introducing features that make every developer more productive: better navigation features like “go to all” (Ctrl + ,), features to improve code quality like Live Unit Testing, and most recently, to enable real time collaboration with Live Share. And we have even started to show how we will use artificial intelligence to assist developers with IntelliCode.

Now, it’s time to start to look at what comes next.

The short answer is Visual Studio 2019

Because the Developer Tools teams (especially .NET and Roslyn) do so much work in GitHub, you’ll start to see check-ins that indicate that we’re laying the foundation for Visual Studio 2019, and we’re now in the early planning phase of Visual Studio 2019 and Visual Studio for Mac. We remain committed to making Visual Studio faster, more reliable, more productive for individuals and teams, easier to use, and easier to get started with. Expect more and better refactorings, better navigation, more capabilities in the debugger, faster solution load, and faster builds. But also expect us to continue to explore how connected capabilities like Live Share can enable developers to collaborate in real time from across the world and how we can make cloud scenarios like working with online source repositories more seamless. Expect us to push the boundaries of individual and team productivity with capabilities like IntelliCode, where Visual Studio can use Azure to train and deliver AI-powered assistance into the IDE.

Our goal with this next release is to make it a simple, easy upgrade for everyone – for example, Visual Studio 2019 previews will install side by side with Visual Studio 2017 and won’t require a major operating system upgrade.

As for timing of the next release, we’ll say more in the coming months, but be assured we want to deliver Visual Studio 2019 quickly and iteratively. We’ve learned a lot from the cadence we’ve used with Visual Studio 2017, and one of the biggest things we have learned is that we can do a lot of good work if we focus on continually delivering and listening to your feedback. There are no bits to preview yet, but the best way to ensure you are on the cutting edge will be to watch this blog and to subscribe to the Visual Studio 2017 Preview.

In the meantime, our team will continue to publish a roadmap of what we’re planning online, work in many open source repositories, and take your feedback through our Developer Community website. This blog post is just another example of sharing our plans with you early, so you can plan and work with us to continue to make Visual Studio a great coding environment.

John

John Montgomery, Director of Program Management for Visual Studio
@JohnMont

John is responsible for product design and customer success for all of Visual Studio, C++, C#, VB, JavaScript, and .NET. John has been at Microsoft for 17 years, working in developer technologies the whole time.

Preview of Visual Studio Kubernetes Tools

$
0
0

Kubernetes is an open source system that is quickly emerging as the preferred container orchestration system for applications of all shapes and sizes, simplifying the deployment, scaling, and operations of application containers. It runs in a variety of environments, including on premises as well as in cloud providers, such as Microsoft’s own Azure Kubernetes Service (AKS).

Here on the Visual Studio team, we are working on ways to better support developers who are building containerized applications that target Kubernetes. In talking to these developers, we’ve heard that it can be challenging to create Dockerfiles, Helm charts, and other configuration-as-code files required to create container images and deploy them to Kubernetes. And taking your code from Visual Studio to your Kubernetes cluster requires memorizing some pretty complicated CLI commands.

We now have a preview available of the first version of the Visual Studio Kubernetes Tools, which aims to simplify the Kubernetes experience for Visual Studio developers. Please note there are some pre-requisites to using these tools, check out the detailed tutorial for complete instructions and guidance.

With the tools installed, you can create a new “Container Application for Kubernetes” project, or add Kubernetes support to an existing .NET Core web application. When you do this, Visual Studio will automatically create a Dockerfile and a Helm chart for your project. You can easily create a container image to run your application, or use these files to deploy to any Kubernetes cluster. These tools will also integrate with Azure Dev Spaces, which provides a rapid, iterative development experience right in Azure Kubernetes Service.

Solution Explorer

Users of Azure Kubernetes Service can also deploy to an AKS cluster directly from Visual Studio, via the new “Publish to Azure AKS” option.

Publish to Azure AKS option in Solution Explorer

If you’re interested in trying out the Visual Studio Kubernetes Tools, please provide your email address on this form. We’ll follow up with a more detailed tutorial and a link to download the tools. Have questions or feedback? You can reach us at vsk8stools@microsoft.com.

Lisa Guthrie, Program Manager, Azure Developer Experience

Lisa has been at Microsoft since 2001, working as a developer support engineer, a Premier Field Engineer, and most recently as a PM. She currently works on container-related tooling for Visual Studio, including Docker, Kubernetes, and Azure Dev Spaces.

Getting Started with Microsoft’s Python Developer Tools

$
0
0

Microsoft’s teams have been working over the last few years to bring Python developer tools to the Azure cloud and our most popular developer tools: Visual Studio Code and Visual Studio. Python is one of the fastest growing languages, with both beginner and expert developers taking to it. What makes it attractive is its easy-to-learn semantics with powerful capabilities for a wide variety of applications from writing scripts, to building web services, to building machine learning models. In this post we’ll take a tour of Python Developer tools in Visual Studio, Visual Studio Code, Azure, and more. For more information and the latest news on everything Python at Microsoft, check out our Python at Microsoft blog.

Visual Studio Code

The Python Extension for Visual Studio Code is fully open source and integrates other open source Python packages for developers to provide rich editing, debugging, and testing capabilities. Python is the fastest growing language in Visual Studio Code, and the Microsoft Python Extension for Visual Studio Code is one of the most popular extensions on the Visual Studio Code marketplace!

To get started, first download Visual Studio Code and then from there you can follow our Getting Started with Python tutorial to install the extension and get the basic features working. Let’s take a quick look at some of the feature highlights.

The first thing you’ll want to do is make sure that Visual Studio Code is using the desired Python interpreter. You can easily select and switch between different Python interpreters by clicking on the Python version in the status bar:

Select Interpreter

The selector supports many different interpreters and Python environments: Python 2, 3, virtualenv, Anaconda, Pipenv and pyenv environments. Once you have picked your interpreter, the extension will use it for IntelliSense, refactoring, linting, running code, and debugging.

To run a Python script locally, you can use the “Python: Create Terminal” command (CTRL + Shift + P to open the command box, or CMD + Shift + P on a Mac) to create a terminal with the environment activated. Or, if you want to run a Python file you simply can right-click on it and select “Run Python File in Terminal”:

Run Python File

Which will then run the file using the selected Python interpreter, in this case a Python 3.6 virtual environment:

Terminal

The Python extension also includes debugging templates for many popular application types. You can head over to the debug tab, and select “Add Configuration…” from the debug configuration dropdown:

Debug Configuration

You will then see preset configurations for debugging the current file, attaching to a remote debug server, or debugging Flask, Django, Pyramid, PySpark or Scrapy apps. You can then select your debug configuration and press the green Play button (or F5 on your keyboard, FN + F5 on a Mac) to start debugging.

The Python extension has support for various code linters that can be configured to run when you save your Python file. By default, PyLint is enabled and you can select your linter of choice by using the “Python: Select Linter” command:

Python Select Linter

That’s not all as there’s also support for unit testing with unittest, pytest and nose; refactoring; and you can use Visual Studio Live Share to remotely collaborate on Python code with other developers!

Python in Visual Studio

Visual Studio provides most of the functionality of Visual Studio Code, with additional powerful IDE capabilities that allow you to do more without having to drop to the command line. Visual Studio also provides unparalleled capabilities when mixing Python projects with C# or C++ projects.

You can Install Python support in Visual Studio on Windows by selecting either the Python Development workload and/or the Data science and analytical applications workload in the Visual Studio installer:

Visual Studio Install

You can choose to install various versions of Python and Anaconda by selecting optional components (on the right-hand side in the screenshot above).

After installing the Python workload, you can start working with Python by creating a Python project in File -> New Project and selecting Python in the installed list:

File New Project

To start from a blank application, you can start with the Python Application template and start writing Python code. You can also create a project from existing Python code, or you can use web templates for Flask, Django, and Bottle. Be sure to check out our Flask Tutorial and Django Tutorial for an in-depth tour of developing web apps using these frameworks with Visual Studio.

If you have the data science workload installed, there are also templates for machine learning projects with Tensorflow and CNTK.

After you have created a project, you can manage your virtual environments and conda environments using the “Python Environments” node in solution explorer and the Python Environments window. You can right->click on the active Python environment and install additional packages:

Visual Studio Environment

The real power of Visual Studio shines when you mix Python with other languages. You can have a solution with both Python and C++ projects, or even embed .py files in your C++ or C# projects!

You can even debug both languages in the same debug session, for example with C++ you can change the debug type to Python/Native debugging:

Python Native

For a detailed walkthrough of embedding Python in a C++ application, be sure to check out Embedding Python in a C++ Project on the Python blog to learn more.

Finally, also worth mentioning that Visual Studio includes a Python profiler and supports Python unit tests in the Test Explorer.

Python in Azure

You can use Python to create, manage and interact with services in Azure using the Python Azure SDK. In fact, the Azure CLI itself is written in Python, which means almost all things you can do with the CLI you can do programmatically using the Python SDK.

You can install individual libraries, for example to install the SDK to interact with Azure Storage:

    pip install azure-storage

It’s recommended that you only install the packages you need, but for convenience you can install the entire azure SDK by running:

    pip install azure

Once you have the SDK installed there are many great services you can use, from using Machine Learning APIs with Azure Cognitive Services to hosting globally distributed data with Azure Cosmos DB.

If you’re building web applications, you can deploy them to Azure Web App for Containers: be sure to check out From Zero to Azure with Python and Visual Studio Code for an end-to-end video tutorial deploying a Flask application using Visual Studio Code, or the quick-start tutorial on deploying a Flask application using the command line.

You can also run freely hosted Jupyter notebooks on Azure, so that you don’t need to install Jupyter locally. You can optionally share notebooks publicly, for example you can view a preview of this publicly shared notebook that generates handwriting using machine learning:

Jupyter Notebooks Screenshot

You can sign-in to clone and run notebooks, so head on over to notebooks.azure.com and sign-in to try it out!

Other Links and Information

Visual Studio Team Services is now able to build cross-platform Python builds using the hosted build agents and the Use Python Version tool tasks. Microsoft has also donated build time to enable CI Builds of the CPython project running on VSTS.

Something else you may not be aware of: SQL Server Machine Learning Services allows you to run Python code within a SQL Server to deliver advanced analytics at scale and avoid having to pull data across the network.

Finally, be sure to check out Microsoft on PyPI for all our Python packages we produce, and check out our Python at Microsoft blog for the latest news on everything Python at Microsoft.

Dan Taylor, Senior Program Manager

Dan Taylor is the Program Manager for Python developer tools at Microsoft. He has been at Microsoft for 7 years and has previously worked on performance improvements to .NET and Visual Studio, as well as profiling and diagnostic tools in Visual Studio and Azure.

Visual Studio 2017 version 15.8 Preview 3

$
0
0

We’re happy to share the highlights of the latest Visual Studio 2017 preview, which is now available for download, including:

This Preview builds upon the features that debuted in Visual Studio version 15.8 Preview 1 and Preview 2 which were both released last month. As always, you can drill into the details of all of these features by exploring the Visual Studio 2017 version 15.8 Preview release notes.

We hope that you will install and use this Preview, and most importantly, share your feedback with us. To acquire the Preview, you can either install it fresh from here, update your bits directly from the Preview IDE, or if you have an Azure subscription, you can simply provision a virtual machine with this latest Preview. We appreciate your early adoption, engagement, and feedback as it helps us ship the most high-quality tools to everyone in the Visual Studio community.

Please note: A number of great new 15.8 features are debuting in Preview 3, so you’ll find this blog is more detailed than most of our preview posts.

Productivity

C# Code Cleanup: The next time you invoke Format Document (Ctrl+K,D) you will see a yellow bar prompting you to configure your code cleanup. These new settings allow you to go beyond simply reformatting your file by enabling you to remove and sort usings as well as fix coding convention violations to match the preferences in your .editorconfig, or lacking that, your Tools>Options configuration. You can change your Format Document settings at any time by going to Tools > Options > Text Editor > C# > Code Style > Formatting > General and see new .editorconfig options for .NET code style in our documentation.

You can change your Format Document settings at any time by going to Tools > Options > Text Editor > C# > Code Style > Formatting > General

Deferred Extension Loading: Visual Studio has a rich ecosystem of extensions that extend functionality and enhance the development experience. Getting all this functionality loaded, initialized, and running can take time. In order to preserve Visual Studio’s startup responsiveness, cooperating extensions won’t be loaded until after a solution has been opened. The progress bar in the task status center will give you visibility into the state of the loaded extensions. Authors of startup performance friendly extensions (i.e. those who have taken advantage of AsyncPackage so that their extensions can load on the background) should test their extension against Visual Studio 2017 version 15.8 and confirm that everything continues to work after deferred loading. See more details in this blog.

Deffered Extension Loading

Multi-Caret Support: In version 15.8 Preview 3, we’re excited to address one of our top voted UserVoice items: native multi-caret support. With this feature, you’ll be able to create multiple insertion points or selections at arbitrary places in your file or add additional selections that match your current selection, allowing you to add, delete or select text in multiple places at once. For a full list of features included with multi-caret support, look under the Edit > Multiple Carets menu flyout.

Additional Keyboard Mappings: We know many people switch between Visual Studio Code and Visual Studio. To help give you a more consistent set of key mappings as you switch between the two, we’ve introduced a new Visual Studio Code keyboard mapping scheme. We’ve also included a key mapping scheme that matches the ReSharper mappings.  You can find and activate these profiles under Tools > Options > Environment > Keyboard > Mapping Schemes dropdown.

Keyboard mappings

Performance

Project Loading: Visual Studio version 15.8 Preview 3 brings faster project reloads for all types of projects. Benefits are huge – project unload and reload that used to take more than a minute for large solutions now takes just a few seconds. Git branch checkout that changes a project file. Stay tuned for more project load performance improvements in subsequent releases. Please check out the Visual Studio Preview release notes for details on how we made these perf gains.

Showing Data Connections from ASP.NET Web Projects in Server Explorer: While loading ASP.NET Web projects, database connections specified in web.config are automatically added to the “Data Connections” node in the Server Explorer window. Adding these connections, particularly if there are a lot of them, may take a long time to complete. Although we have improved the performance of loading these connections, we have also received feedback from some users that they would like to load them manually at a later point. In this update, we introduced a new setting that allows you to configure and control how and when data connections are loaded. This setting, which is checked by default, can be found under Tools -> Options -> Projects and Solutions -> Web Projects: “Automatically show data connections from web.config in Server Explorer”. If it is unchecked, connections will no longer be automatically loaded. You can add them manually by using the context menu “Add Connections from web.config” on the “Data Connections” node in the Server Explorer.

Performance – Profiling Applications

We have a few notable improvements to highlight in this Preview regarding the CPU Usage Tool. These improvements build upon the CPU Usage Tool features we announced with version 15.8 Preview 2.

Pause/Resume for Collection of CPU Usage data: The CPU Usage tool in the Performance Profiler (ALT-F2) can now start in a paused state, which means that it will not collect any CPU usage sample stack data until it is specifically enabled. This makes the resultant amount of data much smaller to collect and analyze, thus making your performance investigations more efficient. Once you start the target application, a monitoring display will show the CPU utilization graph and will allow you to control the CPU profiling and enable/disable sample data collection as many times as you like.

Pause / Resume Collection of CPU Usage Data

The CPU utilization graph changes color to indicate whether sample collection is enabled/disabled at that point in time.

The .NET Object Allocation Tracking Tool joins the family of tools available from the Performance Profiler (ALT-F2). Invoking this tool for a performance profiler session causes the collection of a stack trace for every .NET object allocation that occurs in the target application. This stack data is analyzed along with object type and size information to reveal details of the memory activity of your application. You can quickly determine the allocation patterns in your code and identify anomalies as well. In addition, for Garbage Collection events, you can easily determine which objects were collected and which were retained, quickly determining object types which dominate the memory usage of your application. This is especially useful for API writers to help minimize allocations. While your test application is executing, the Performance Profiler displays a monitoring view with a line graph of Live Objects (count), as well as an Object Delta (% change) bar graph.

The .NET Object Allocation Tracking Tool

Refer to the Visual Studio Preview release notes for details on how to configure settings for these tools and learn more about how to use them. Please give the CPU Usage Tool and the .NET Object Allocation Tracking a try and send feedback if you have any issues or suggestions.

JavaScript and TypeScript Tooling

There are a lot of improvements to JavaScript and TypeScript tooling in this version 15.8 Preview. Highlights include:

TypeScript 2.9: This release includes TypeScript 2.9 by default, which includes richer IntelliSense for some common JavaScript patterns, several new refactorings, and numerous type system improvements. For full details, see the recent TypeScript 2.9 blog post.

Improved Vue.js support: Support for the Vue.js library has been improved, particularly regarding support for .vue files, aka “single file components”, and enhancements when editing script blocks inside .vue files. Additionally, when the Node.js workload is installed, the New Project dialog will contain additional “Basic Vue.js Web Application” templates under the “JavaScript / Node.js” or “TypeScript / Node.js” paths.

Improved Vue.js support

ESLint support has been reimplemented in this release, and the following functionality is now enabled. Rather than only linting saved files, Visual Studio will now lint JavaScript files while they’re opened and being edited. Additionally, results will be reported for all JS files in your project, not just open files. If there are parts of your project you do not want to be linted, an .eslintignore file can now be used to specify directories and files that should be ignored. ESLint has been updated to use ESLint 4 by default, but if your project has a local installation of ESLint, it will use that version instead.

Visual Studio will now lint JavaScript files while they are open and being edited

Open Folder: Visual Studio 2017 version 15.8 Preview 3 includes productivity improvements to the Node.js and TypeScript development experience. For example, when working in Visual Studio via the “File / Open / Folder…” menu option, you can now right-click to bring up the context menu and select “Build” to build the TypeScript code with the latest TypeScript compiler, “Debug” to run the file with the debugger attached, or “Npm” to invoke NPM package management commands. Refer to the Visual Studio Preview release notes for details on how to configure your projects so these commands are available.

Npm right click context menu with Build Debug and Npm options

Improved Editor Performance: In previous releases, all JavaScript and TypeScript language service operations were serviced by a single Node.js process. This could cause editor delays if commands that impact user typing (such as automatic formatting after a newline) were sent while a potentially lengthy operation was already in process (such as analyzing code for errors). To mitigate this, a separate process is now used for the operations that most impact editing. This process is significantly lighter on system resources than the existing language service process.

C++ Development

C++ Templates IntelliSense: Visual Studio 2017 version 15.8 Preview 3 brings IntelliSense for Templates – you can provide more details about template arguments to take full advantage of IntelliSense within your template body.

C++ Refactoring: We’ve also added a new quick-fix lightbulb to convert basic macros to constexpr as a new tool to modernize your C++ code.

C++ Just My Code debugging enables you now to step-over code from system or 3rd party C++ libraries in addition to collapsing those calls in the call-stack window. You get to control this behavior for any C++ libraries when your code is compiled with /JMC (the default for Debug configurations) and the non-user libraries paths are specified in a .natjmc file. If the system library calls into user-code, when you step in, the debugger will skip all system code and will stop on the first line of user-code callback.

Code Analysis: We are continuously working to refresh our code analysis experience. You can now enable the new, in-progress features under Tools > Options > Text Editor > C++ > Experimental > Code Analysis. Code analysis can run in the background when files are opened or saved, and results will be displayed in the error list and as green squiggles in the editor.

Code analysis results displayed in the error list and as green squiggles in the editor

CMake: Adding configurations to CMakeSettings.json is now as simple as selecting a template.

C++ Standards: A new, experimental, token-based preprocessor that conforms to C++11 standards (including C99 preprocessor features), enabled with /experimental:preprocessor switch. This will be controlled with macro _MSVC_TRADITIONAL, which will be defined to 1 when using the traditional preprocessor and 0 when using the new experimental standards conformant preprocessor.

Spectre mitigations: The Visual Studio Developer Command Prompt now supports enabling the Visual C++ Spectre variant 1 mitigated runtimes (via the -vcvars_spectre_libs=spectre switch). More information about Spectre mitigations is available on the Visual C++ Team Blog.

Visual Basic Development

Integer manipulation: Visual Basic normally uses functions in the System.Math library when converting non-integer types to integers. This is generally beneficial as the conversion provides a rounded result. However, there is a performance penalty when rounding is not needed. Since Visual Basic programmers indicate truncation with Fix(), a new optimization will be applied to the pattern CInt(Fix(number)) which will improve performance is scenarios such as graphics manipulation.

Azure Development

Azure Functions: You can now configure continuous delivery for solutions with Azure Function Projects directly from Visual Studio 2017. Right click on the solution and click “Configure Continuous Delivery to Azure…”, to launch the dialog. Select “Azure Function” as a target host type and click OK. Visual Studio will automatically create a new Azure Function, a build definition and a release definition targeting that host to automatically deploy your azure function every time you update your code.”

Azure Key Vault: We have continued to build on the secret management experience by adding the ability to configure an Azure Key Vault with your published application. The Azure Key Vault provides a secure location to safeguard keys and other secrets used by applications so that they do not get shared unintentionally.  You can attach a Key Vault already connected with your local project to the published application through the publish summary page. Otherwise, setting a Key Vault up through the publish summary page will attach a Key Vault to both the published and local application.

Publishing Apps to Azure : When creating a new App Service, Visual Studio now offers the ability to configure Application Insights for your site as part of the initial creation process. Application Insights provides diagnostic, analytics, and performance data for your site. If Application Insights is available in the region of your site, it will automatically be enabled as indicated by the Application Insights dropdown being set to the same location as your App Service. If Application Insights is not currently available in the region as your site it will default to “None”, but you can still enable it by selecting a supported region to run Application Insights in for your site.

Web Development

A couple of months ago, we introduced a new Library Manager (LibMan), a lightweight effective solution for web developers to easily manage common client-side library files. Features of the Library Manager include support for common operations like restore and clean, as well as productivity aides like IntelliSense. In this Preview, the Library Manager added UI tooling to find and select library files in order to add them to your project. Additionally, LibMan now recognizes another provider, UnPkg, which provides access to all files available on the npm repository.

Library Manager added UI tooling to find and select library files in order to add them to your project

Mobile Development

Android Incremental Build Improvements: Xamarin.Android leverages files generated in the intermediate output directory to achieve incremental builds that are faster than full builds. Previously, if you changed your project’s target framework it would invalidate the files and result in a full build on the next run. In this release we now preserve the files in per-framework folders so you can switch between different target frameworks and still benefit from incremental builds. Cleaning the project will allow you to reclaim the disk space used by the preserved files.

Xamarin.Essentials APIs: Our Xamarin templates in Visual Studio 2017 have been updated to include Xamarin.Essentials, a core set of cross-platform APIs to help developers build native apps. Xamarin.Essentials gives developers access to over 30 platform-specific APIs that can be accessed from their shared code, including geolocation, secure storage, sensors, device information, and many more. Best of all, it can be used in any iOS, Android, UWP, or Xamarin.Forms app, regardless of how you create the user interface.

Try out the Preview today!

If you’re not familiar with Visual Studio Previews, take a moment to read the Visual Studio 2017 Release Rhythm. Remember that Visual Studio 2017 Previews can be installed side-by-side with other versions of Visual Studio and other installs of Visual Studio 2017 without adversely affecting either your machine or your productivity. Previews provide an opportunity for you to receive fixes faster and try out upcoming functionality before they become mainstream. Similarly, the Previews enable the Visual Studio engineering team to validate usage, incorporate suggestions, and detect flaws earlier in the development process. We are highly responsive to feedback coming in through the Previews and look forward to hearing from you.

Please get the Visual Studio Preview today, exercise your favorite workloads, and tell us what you think. If you have an Azure subscription, you can provision a virtual machine of this preview. You can report issues to us via the Report a Problem tool in Visual Studio or you can share a suggestion on UserVoice. You’ll be able to track your issues in the Visual Studio Developer Community where you can ask questions and find answers. You can also engage with us and other Visual Studio developers through our Visual Studio conversation in the Gitter community (requires GitHub account). Thank you for using the Visual Studio Previews.

Christine Ruana Principal Program Manager, Visual Studio

Christine is on the Visual Studio release engineering team and is responsible for making Visual Studio releases available to our customers around the world.

Announcing the public preview of Azure Dev Spaces

$
0
0

Today, we are excited to announce the public preview of Azure Dev Spaces, a cloud-native development experience for Azure Kubernetes Service (AKS), where you can work on your applications while always staying connected with the cloud and your team. Over the last year, we have spoken to many developers working in different languages and platforms who are exploring Kubernetes. They are excited about the opportunities it presents for them to build cloud-native applications with containers and microservices without having to do any infrastructure management or orchestration. We are also seeing enterprise teams migrating their existing apps to Kubernetes and then incrementally modernizing them by extracting application functionality into microservices. AKS makes it easier for application development teams to get going with Kubernetes in the cloud and Dev Spaces enables a familiar yet powerful developer workflow for building apps on AKS.

Containers and the microservices pattern enable you to build cloud-scale applications that are scalable and durable, where each microservice can be independently managed and updated. For dev teams, a key benefit of this pattern is that it parallelizes development. However, microservices introduce new challenges in your workflow. Some considerations developers working in a team (which is most developers) now have is: How do you work on your service when it depends on other services that are also being changed at the same time? How do you establish a baseline that all members in the team can work on until they are ready to commit changes? Since your microservice by design only handles a specific functionality needed by the application, how do you test any changes to it end-to-end? Azure Dev Spaces is a new service that helps you address these challenges and build cloud-native apps on AKS from your favorite tools.

Getting started on Kubernetes with Dev Spaces

Dev Spaces makes it easy for you to take your first steps into container development. You can use Dev Spaces with your code editor of choice to scaffold the artifacts required to build and run your code in a container, such as the Dockerfile. This allows you to quickly containerize your application. Your code is then synced to the cloud, where it is built and deployed as a container into AKS. Now you can edit and debug this code as if it’s all running locally on your machine. All without you having to install Docker or Kubernetes tooling on your local machine or having to learn about Docker or Kubernetes concepts such as Dockerfiles or Helm charts. But when you are ready to dive deeper into these amazing technologies, you are all set up with the right artifacts to start that journey.

It’s easy to get going with Dev Spaces – simply pick a Dev Space and spin up your app in it. In a few seconds, your app is running on Azure in AKS.

Pick a Dev Space and spin up your app

Now that your app is running in a Dev Space, you can make changes to it and debug it all on Azure.

Debug your app in Azure

Leveraging microservices and containers for your apps with Dev Spaces

Dev Spaces really shines when the app you are working on has many microservices. As your application gets past a couple of microservices, it becomes increasingly difficult to reap the productivity benefits of parallelized development. Imagine you are a developer who has just joined a team working on an application composed of microservices. You know which service or set of services you need to work on, but you don’t know how the different services of the application call each other. You also want a good level of confidence that when you commit your code and deploy it in your team’s integration testing environment, the overall application will continue to work with your changes. Typically, you would mock the dependencies that your services have on other services but how do you handle services that make calls to the services you are tasked with changing? And even if you could reproduce all the upstream and downstream dependencies locally on your machine, you’d be spending a good amount of time just setting them up, especially if they are written in different languages and require runtimes you must install locally. You end up with a lot of lost time that you’d have rather spent on working on the task at hand. And there is all the clutter on your machine that you need to clean up.

We built Azure Dev Spaces to specifically address these concerns and ensure that you get the same productive experiences that you have come to expect from Visual Studio and Visual Studio Code, even when building cloud applications. With your IDE or editor connected to an AKS cluster enabled with Dev Spaces, you can edit and debug your services while always operating in the context of the overall application. You create and work in your own space within the cluster; every space has a unique URL endpoint corresponding to the public endpoints your application is configured with. Then you can clone the service or set of services that you will be modifying and “up” them into your private space. As part of the development you will often want to debug just your services. You can simply set breakpoints and debug your service as if it were running locally. As you work on your service(s), you can hit the special endpoint for the overall application with your test requests. Dev Spaces is smart enough to route your requests through the default set of microservices in your application. For the services that you have “up”ed in your space, Azure Dev Spaces routes any upstream calls to them for these test requests. You can even set breakpoints on multiple services that you are working on in your space and debug across them and the overall application.

The following video shows how you can work on a service called MyWebApi that is called by a separate service called Webfrontend. You can work on MyWebApi in your own space, but test it end-to-end without having to mock Webfrontend or make a copy of it in your space. You can find the sample used here in our GitHub repo. While this is a simple example, you can leverage the same capabilities when working on a subset of microservices in an application that has 10s or 100s, and your upstream and downstream microservices are also changing all the time.

Gif showing how you can work on a service called MyWebApi

For more details on Azure Dev Spaces, configuring your dev setup to work with Dev Spaces, and using it as part of your dev workflow, please see the Quickstarts and Tutorials.

What’s next

We announced the private preview of Azure Dev Spaces in May at //build and excited about making it available to everybody now. To get started, simply head to https://aka.ms/get-azds.

Currently, you can develop in .NET Core and Node.js, both on Linux, in Dev Spaces. In addition to editing and debugging microservices independently from Visual Studio and Visual Studio Code, we are excited to see customers starting to use Dev Spaces for other scenarios such as integration testing and for supporting their GitHub flow. In the next few months, we will be announcing support for additional languages and such scenarios. As you delve more and more into cloud-native development, our goal is to support you with the right experience and enable rapid productivity with cloud-native development. Are there other challenges you have with cloud-native development? Do you have any feedback on Azure Dev Spaces? Let us know here in the comments or connect with our engineering team via GitHub.

Balan Subramanian, Azure Developer Experience
@balansubr

Balan leads the Azure DevEx product team tasked with creating delightful experiences on Azure for all kinds of developers. This team builds and manages tooling for Azure services, SDKs and CLIs for Azure, OSS integrations, and services such as Azure Container Registry, Azure Lab Services and Azure Redis Cache. He is particularly interested in helping developers go cloud-native both in the apps they are building and their DevOps. Before coming to Microsoft, Balan launched new services for developers at Heroku and AWS.


Azure Service Fabric Mesh tools now available for Visual Studio 2017

$
0
0

Azure Service Fabric is a market-tested distributed systems platform for running scalable and reliable applications on microservices and containers. Up until now, Service Fabric required you to create and manage the clusters and their nodes using virtual machine scale sets. With today’s announcement of Azure Service Fabric Mesh, you’ll be able to use Service Fabric without managing infrastructure such as VMs, storage, or networking. Additionally, we’ve released Service Fabric Mesh tooling in Visual Studio 2017 to help you build applications.

Previously, you had to describe your Service Fabric applications with XML manifests, which was complex and tedious. The new resource-based application uses lightweight YAML files to describe your application and the resources that make it up, making it easier to specify and modify these resources. The tools also help you scaffold applications, debug microservices, and publish your application to Mesh.

Ready to get started? We’ll walk you through how to take advantage of the managed infrastructure and the simplified YAML files for defining your applications.

Get Started with Service Fabric Mesh tools in Visual Studio 2017

After you download the Mesh tools, you’ll notice we’ve added a new entry for Service Fabric Mesh Application in the new project dialog.

Service Fabric Mesh in New Project Dialog, under Visual CSharp, Cloud

You might notice the new Container OS drop-down. Right now, local Service Fabric developer cluster debugging is Windows-only, but Service Fabric Mesh supports both Linux and Windows containers. Before publishing to Azure, you can change your service to use a Linux-based image by changing the “osType” property in the service.yaml file.

Service Fabric ASP.NET Core applications have two projects in the solution. The service.yaml file that is included in your main service project describes your service to the Service Fabric runtime. This file contains any endpoints your service will be listening on, environment variables, and other properties, including any resource constraints you want enforced. There’s also a Dockerfile with instructions for the Docker image that gets built for your service when it’s running in Service Fabric. The tools configure the Dockerfile to work with the service you select. Usually you won’t need to worry about this file, but you are free to modify it if you want to use a different base image or include additional dependencies.

Service Fabric Mesh in Visual Studio

The second project in this example, HotelApp, is a lightweight project for configuring application-wide settings. By default, the app.yaml and network.yaml files contain basic configuration information. During debugging and publishing, Visual Studio will use the Service Fabric SDK to merge the various YAML files and deploy them, along with your service(s), to Service Fabric.

Publishing and Debugging your Service Fabric Mesh Application

You can set breakpoints and debug your code just like any other .NET Core application. When it’s time to publish your application to Azure Service Fabric Mesh, right click the application project and select Publish. This brings up the following dialog where you’ll need to specify a few values to successfully publish your application.

Service Fabric Mesh Publish dialog showing options like Subscription, Location, and Azure container registry

Publishing from Visual Studio builds the exe/dll for each service, creates Docker images for the services, pushes them to Azure Container Registry, and deploys the application to Mesh. Once publish is complete, Visual Studio will show you each of the ingress endpoint URLs for each of your services that had one defined.

You can get more information about these steps by following our Service Fabric Mesh Quickstart.

Share Your Thoughts

When you try the new Service Fabric Mesh tooling, we’d love to hear your feedback! Leave a message for us through Visual Studio or add a comment to this blog post. You can get started setting up your development machine here.

Cristy Gonzalez, Program Manager, Azure Developer Experiences

Cristy has been a PM at Microsoft since 2013. In that time, she has worked on the Azure SDK, Storage Explorer, Azure Diagnostics, and Azure developer services like DevTest Labs and ACR. She’s currently working on experiences for users getting started with Azure.

Visual Studio IntelliCode now infers coding conventions for consistent code

$
0
0

Following the initial announcement of Visual Studio IntelliCode at Build 2018, we’re excited to report that the Visual Studio IntelliCode Extension has been updated to enable coding convention inference for C#, to help you and your team achieve more readable and consistent code. If you’re new to the Intellicode extension, it already provides AI-assisted IntelliSense suggestions, which you can read about in the initial announcement. If you already have the extension installed, you may have automatically received this update. If not, you can get started now by downloading the extension.

Inferring code style and formatting conventions for your codebase

Inferring code style and formatting conventions for your codebase

Consistency is important for code maintainability and readability; in fact, a recent Microsoft Research study in this area showed that 18 percent of pull request review comments were related to coding conventions, styles, and naming issues.  

With this update, the IntelliCode extension can now generate an .editorconfig file on-demand that best matches the coding conventions used in your codebase; no more long discussions with your team about the best convention to use! Once generated, this file will help you maintain consistency in your team’s codebase. Fixing up formatting issues is quick and easy with the Quick Action lightbulb menu (Ctrl+. or Alt+Enter) or with the new configurable Format Document (Ctrl+K, D) in Visual Studio 2017 version 15.8 Preview 3 and higher. 

How to use .editorconfig inference

IntelliCode creates the inferred .editorconfig file by scanning the code files below your chosen location to create the best matching set of conventions. Once it’s there, you will see any coding convention violations related to style show up in the error list as Messages as illustrated below:

Coding convention violations related to style show up in the error list as Messages

The style violations are set up to default to “Message” severity – this is shown by the “:suggestion” suffix on each rule line in the .editorconfig file .You can tweak the file if you want a different level of enforcement, like warning or error.  Note that formatting violations do not show up in the Error List,  but can still be fixed easily – see our “how to” below.

You can invoke EditorConfig generation via the Solution Explorer. Simply right-click on the solution, project, or folder level folder where you want the conventions to apply, select “add”, and then “EditorConfig file (IntelliCode)”. For projects you can also select “add” then “new item” then “EditorConfig file (IntelliCode)”. Note that EditorConfig files apply enforcement hierarchically to all files below it in the filesystem “cone”. For instance, if you want a set of conventions that apply to your whole solution, place your .editorconfig in the solution directory. If you have subfolders or projects that have different conventions, you can create a new EditorConfig for those subfolders/projects to override the conventions from the higher level.

How to fix up your code to conform to the new conventions

There are a couple of ways to clean up your code to conform to the new conventions, depending on your goals.

  1. Using Quick Actions Lightbulb Menu (Ctrl+. or Alt+Enter)
    For style issues, lightbulbs will appear (along with error list entries), to allow you to auto-fix any inconsistencies. You can choose the scope of the fix in the lightbulb – instance, document, project or solution.
  1. Using Format Document (Ctrl+K,D)
    For both format and style issues, if you are using Visual Studio 2017 15.8 Preview 3 or higher, you’ll be able to use the extended “Format Document” command to perform additional code cleanup for the current document. This will fix up the code in that document to conform to the conventions you just created, allowing you to adopt a “clean up as you touch each file” approach to getting consistent. Note that this additional capability in format document only covers a fixed set of issues, which you can change in Tools > Options > Text Editor > C# > Code Style > Formatting > General > Format Document Settings (Experiment):Format Document Options Extension For Conventions

Notice that the default settings do not fix some style conventions. You can opt in to these via tools options (e.g. Apply implicit/explicit type preferences will run style rules related to the use of var in your code).

Things to be aware of when using EditorConfig inference

There are a couple of known issues to be aware of when using EditorConfig inference:

  1. You need to close and reopen open files to see changes to the conventions apply in 15.8 Preview 2 and earlier
    In Visual Studio 2017 versions prior to 15.8 Preview 3, you will need to close and re-open all open documents to see the conventions in the EditorConfig file you create take effect. This is fixed in the 15.8 Preview 3 release.
  1. Creating through the File-New Item dialog adds a “1” To the filename
    If you use the File-New Item dialog route to create your EditorConfig, in Visual Studio versions prior to 15.8 Preview 4, you’ll need to manually remove the superfluous “1” Prefixing the EditorConfig file name in the dialog. This is fixed in the 15.8 Preview 4 release.

Thanks for all your interest in IntelliCode. We’re excited to hear your feedback and improve IntelliCode as we make more progress. Use the extension’s review page to make suggestions; if you find any problems with the extension, please use the built-in Visual Studio “Report a Problem” option, and mention IntelliCode in your report – reporting this way helps us gather helpful information to resolve the issue.

Get Involved

As we expand capabilities to more scenarios and other languages, we’ll announce a limited preview of IntelliCode.

Sign up to become an insider to keep up with the project and join the waitlist for the private preview.

Thanks!

Mark Wilson-Thomas, Senior Program Manager, Visual Studio IDE Team
@MarkPavWT

Mark is a Program Manager on the Visual Studio IDE team, where he’s been building developer tools for nearly 10 years. He currently looks after the Visual Studio Editor. Prior to that, he worked on tools for Office, SQL, WPF and Silverlight.

Visual Studio IntelliCode expands AI-assisted coding to Python in Visual Studio Code

$
0
0

Today at the EuroPython conference in Edinburgh, Scotland, we are introducing support for Python in the IntelliCode extension for Visual Studio Code, as well as new improvements in editing for Python developers in Visual Studio Code.

AI-assisted IntelliSense for Python

At Microsoft Build 2018, we first announced IntelliCode, a set of AI-assisted capabilities to improve developer productivity. We shipped a preview extension showing the first of these capabilities: presenting the most relevant completions as you type in Visual Studio. Today, we are bringing the power of machine learning trained on over 2,000 open-source repos to Python developers using Visual Studio Code. Check out the video below to see IntelliCode for Python in action.

When writing Python code, the IntelliSense code completion speeds up your productivity by providing suggestions as you type. However, there can be hundreds of completions to scroll through, and you typically need to type the first few characters out before you can get close to the right result. Using our machine learning algorithm, IntelliCode can infer the most relevant completions based on the current code context.

In the below example of writing TensorFlow code, we can see the starred items in the completion list are provided by IntelliCode, allowing you to select from the top items rather than having to search through the completion list:

Example of writing TensorFlow code showing starred items in completion list provided by IntelliCode, without having to search through completion list

Notice how in each case we used the “tf.” variable but the suggestions change to present the most relevant options for the code context in which the tf variable is being used.

These suggestions work on a broad variety of code included in our 2,000+ repo training set: machine learning frameworks, web frameworks, to general purpose scripting. Simply install both the IntelliCode extension and the Python extension, and IntelliCode will download the latest machine learning model and start making suggestions.

Microsoft Python Language Server (Preview)

For Python, IntelliCode builds on top of our Microsoft Python Language Server: our fast and powerful language server which was introduced in the July 2018 release of the Python extension for Visual Studio Code.

IntelliCode will prompt you to enable the Microsoft Python Language server, so you’ll also notice that you get enhanced IntelliSense with syntax errors and basic warnings will now appear as you type. IntelliSense, combined with the new Python Language Server, is also richer: the language server uses open-source typeshed definitions to provide completions for types where they can’t be statically inferred.

The combination of both the new Python extension features and IntelliCode will make you more productive when writing everyday Python code.

More Improvements for Python in Visual Studio Code

We have been continuing to add improvements for Python developers in Visual Studio Code. At Build 2018, we announced the public preview of Visual Studio Live Share including support for Python, allowing you to collaborate on code with other co-workers regardless of whether they are using the Visual Studio IDE or Visual Studio Code for their Python coding.

For everything else Python at Microsoft, be sure to check out our Python at Microsoft blog.

Get Involved

As we expand IntelliCode’s capabilities to more scenarios and other languages, we’ll announce a limited private preview of new features.

Sign up to become an insider to keep up with the project and join the waitlist for the private preview.

Dan Taylor, Senior Program Manager, Python Developer Tools

Dan Taylor is the Program Manager for Python developer tools at Microsoft. He has been at Microsoft for 7 years and has previously worked on performance improvements to .NET and Visual Studio, as well as profiling and diagnostic tools in Visual Studio and Azure.

 

How to Convince Your Management to Upgrade to Visual Studio 2017 for C# and C++ Developers

$
0
0

Have you tried Visual Studio 2017 at home and want to use it at work? Here are eight reasons to upgrade today that you can share with your management:

  1. Faster Than Ever
  2. Efficient Code Navigation
  3. Refactorings and Quick Actions
  4. Additions to Core Editor Functionality
  5. Debugging Improvements
  6. New and Refreshed Unit Testing Experience
  7. Code Style Configuration and Enforcement
  8. C# 7.3 and MSVC Standards Conformance
  9. Upgrade today!


Reason 1: Faster Than Ever

We have made (and are continuing to make) substantial improvements to solution load and startup, branch switching, and unit test discovery times. Starting from Visual Studio 2017 version 15.6, solutions load on average 35% faster than in Visual Studio 2015. In fact, .NET and C++ developers opening large solutions in Visual Studio 2017 will notice their solutions load twice as fast as they did in 2015. Say goodbye to startup delays!

We have great news about Visual Studio setup; the setup experience is faster and more lightweight than ever. Our new install experience allows you to pick and choose what you want to install–significantly reducing your install time and size, getting you up and running in Visual Studio 2017 in no time. It also installs side-by-side with previous versions of Visual Studio.


Reason 2: Efficient Code Navigation

We know you spend as much time understanding code as writing new code, so great navigation tools are paramount to your success as a developer. Here is how you can navigate effectively in Visual Studio 2017:

  • Search files, types, members, and symbols in Go To All (Ctrl+T or Ctrl+,) – Use this symbolic search (with category filters and individualized commands) to jump to files and symbols in your codebase without having to go through the Solution Explorer. To filter your search results to only types, for example, use the query syntax (e.g., “t myType”), the type filter button, or the command Edit.GoToType (see under Edit > Go To). Go To All search also has support for camelCase matching so you don’t have to type as many characters to get the results you need (e.g., “mf” for “myFile.cs”).
  • Group, sort, filter, and lock results in Find All References (Shift+F12) – Group your .NET and C++ reference results by document, project, definition, etc. to quickly narrow down on the results you’re looking for (whether it be identifying dead code or investigating the ramifications of a refactoring). For .NET development, view colorized symbol references in Find All References, so your results look like the code in the editor.
  • Ctrl+Click to Go To Definition – Hold down Ctrl, hover over a symbol to create a link, and click to navigate to the definition. This is especially helpful if you are fond of the mouse or if you are scrolling and exploring during a debug session.
  • Go To Implementation for .NET (Ctrl+F12) – See all implementations of a base type or member. If there is only one, we’ll jump you right there! In Visual Studio 2017, you can Go To Definition on the ‘override’ keyword in a method signature to go back to the overridden base type or member.
  • Navigate to decompiled assemblies for C# source (F12) – Enable this feature to view method bodies of external sources (rather than just signatures in Metadata As Source) when you Go To Definition. To turn this feature on, go to Tools > Options > Text Editor > C# > Advanced > Navigate to decompiled assemblies.

Go To All showing recent files and scope to current file options highlighted

Reason 3: Refactorings and Quick Actions

Each release of Visual Studio 2017 brings more and more refactorings and quick fixes. Any quick action or refactoring can be triggered using Ctrl+. or Alt+Enter (for single-hand accessibility). Here are some of the ones you requested that made it in so far in .NET, across versions 15.0 through 15.8:

  • Add null-check
  • Invert if-statement
  • Resolve merge-conflict
  • Convert LINQ query to foreach
  • Convert foreach-to-for-loop and vice versa
  • Toggle between ‘var’ and the explicit type
  • Sync file and type name
  • Move type to file with same name
  • Add parameter to constructor or method from callsite
  • Convert String.Format to interpolated string
  • Make private field readonly
  • Add missing modifier and sort modifiers
  • Remove unused variable
  • Remove unnecessary parentheses

For C++ there are a couple new quick actions to note:

  • Convert Macro to Constexpr
  • Change Declaration to use Constexpr

Because the .NET experience in Visual Studio 2017 is built on the Roslyn language service, any developer can write their own refactoring or code analyzer to automate actions or enforce style. Read our walkthroughs to get started or check out existing community analyzers you can download.

Invert If statement

Reason 4: Additions to Core Editor Functionality

We’ve added (and are working to add more) common editor features so you can quickly move around and edit your code:

  • Expand/Contract Selection (Alt+Shift+[+/-]) – Grow and shrink your selection by code constructs, i.e., from symbol to expression to statement to body to file.
  • Duplicate Line (Ctrl+D in the Default profile) – Duplicate the selected text (or the current line, if no selection) without adding anything to your Copy/Paste clipboard.
  • Multi-caret editing (Ctrl+Alt+Click and Shift+Alt+Ins) — Create multiple insertion points via Ctrl + Alt + Click or add new carets and selections that match the current selection with Shift + Alt + Ins.
  • Structure guide lines – Easily visualize the structure of your code with vertical lines between braces. Hover on the lines to see a hierarchy of code structure.
  • New Keymapping Schemes — If you’re coming from another IDE or coding environment, you can change your keyboard scheme with Tools > Options > Environment > Keyboard and use the drop down to select the new VS Code or ReSharper (VS) schemes.

For C++ development, we have added several other editor improvements:

  • Open Folder Mode – Edit, read, build, and debug C++ code by opening folders containing source code without the need to create any solutions or projects. This includes built-in support for handling CMake projects.
  • Template IntelliSense – The editor now displays a ‘Template Bar’ which allows C++ developers to provide sample template arguments for improved IntelliSense in class/function templates.
  • Macro Expansion in Quick Info – Hovering over a macro will display the actual expansion of the macro that the preprocessor will replace during the first stage of compilation.

CPP Template IntelliSense

Reason 5: Debugging Improvements

The Visual Studio 2017 debugger allows you to diagnose issues faster by surfacing critical information and functionality without requiring new breakpoints and a restart of your debugging session.

  • The new Exception Helper – See which variable or member is returning null when a NullReferenceException is thrown, and tweak exception configuration options.
  • Step Back debugging (Enterprise only) – Go back to previous breakpoints or steps and view the state of the application as it was in the past.
  • Run To Click – Hover at the beginning of a line of code and click the green play button to run the debugger to your location without having to hunt down the yellow instruction pointer.
  • Just My Code stepping for C++ – Step over non-user code, so you don’t have to spend your time stepping over countless lines of library code that you’re not interested in.


Reason 6: New and Refreshed Unit Testing Experience

We buckled down on providing a fast and productive unit testing experience for MSTest (v1.0 and 2.0), NUnit, XUnit, Google Test, and Boost frameworks:

  • Test Explorer Performance Improvements – Test discovery is fast in Visual Studio 2017 and we will instantly display newly added tests (without requiring a build).
  • Test Explorer Hierarchy View — We’ve also added a hierarchy view of your unit tests so that you can explore and run them by project, class, etc. Test runs now also have responsive icons so you can see what tests are currently executing and pending to execute.
  • Live Unit Testing for .NET (Enterprise only) – As you type, Live Unit Testing identifies which unit tests are impacted by your code change, runs those tests, and updates icons in the editor to display the results of the test run. You can configure what tests are discovered and run in your “live test set” by including or excluding test projects or individual tests. To enable Live Unit Testing, go to Test > Live Unit Testing > Start.
  • Google Test and Boost support for C++ — The Google Test and Boost.Test unit testing frameworks are completely supported and integrated with Visual Studio’s testing tools.

Test Explorer showing Test Heirarchy

Reason 7: Code Style Configuration and Enforcement

Visual Studio 2017 enables individuals and teams to drive consistency across their codebase with coding convention configuration and enforcement.

  • Individual Coding Conventions for .NET – Configure your coding preferences for your machine in Tools > Options > Text Editor > C# | Basic > Code Style.
  • Team Coding Conventions for .NET – Use .editorconfig (we worked with the community to extend the open-source file format to work with .NET code style) to codify your conventions and have them enforced in Visual Studio. Say goodbye to managing your rules from a file share!
  • Fix All Violations – Use the lightbulb menu (Ctrl+. or Alt+Enter) and select the Document, Project, or Solution scope from the preview dialog to fix all violations of a single rule.
  • One-click Code Cleanup for .NET —In Visual Studio 2017 15.8, you can perform additional code cleanup with Format Document (Ctlr+K,D) by configuring it in Tools > Options > Text Editor > C# > Code Style > Formatting and checking fixes like Remove and Sort usings.
  • ClangFormat for C++ – In addition to EditorConfig, ClangFormat is supported, giving C++ developers the ability to style and format their code based on a set of rules that can be configured in a .clang-format or _clang-format file.


Reason 8: C# 7.3 and MSVC Standards Conformance

C# 7.0 ships with Visual Studio 2017 by default, bringing language features like tuples, pattern-matching, and out var to help you work with data and make your code more readable. You can also upgrade your project to be on the “latest minor” version of C# and take advantage of features in our point-releases like: async Main, Span, Enum constraints, and more!

As of Visual Studio 2017 version 15.7, MSVC compiler toolset conforms to the C++ Standard up to and including C++17, with minor exceptions. The C++ team worked to significantly overhaul the compiler, making it far easier to implement modern C++ features. Additionally, we added the C++ Core Guidelines Check extension (CppCoreCheck). This extension is designed to make it easy to adopt C++ Core Guidelines and adopt utilities from the Guidelines Support Library.

Migration to Visual Studio 2017 for C++ is easier than ever before. Visual Studio C++ 2017 is binary compatible with Visual Studio C++ 2015, so there is no need to rebuild your 2015 component. Furthermore, the decoupling of toolsets means that you can use your toolset from 2013 or later.


Upgrade Today

Upgrading may be extremely easy for your team–if you and your team are on Visual Studio Community or have an EA/Subscription, you already have access to a Visual Studio 2017 license today. To learn more about how to upgrade, visit our upgrade site. To learn more about how you can be productive in Visual Studio 2017, check out the productivity guide for .NET developers for a comprehensive overview of our tools and features.

Give Us Feedback

We’re releasing updates to Visual Studio at a faster cadence than ever before so that we can unblock you on any issues you may have and evolve and create features to make you more productive in your everyday workflow.

Use the Send Feedback button inside Visual Studio to have direct access to the product team (we look at all of them!) and to easily share memory dumps and traces so that we can more quickly investigate issues with performance you may have. Also use button to request productivity features you need to code with ease and confidence. We are here to help you upgrade!

Kasey Uhlenhuth, Program Manager, Visual Studio and .NET
@kuhlenhuth

Kasey Uhlenhuth is a Program Manager on the .NET and Visual Studio team working to improve developer productivity.

Nick Uhlenhuth, Program Manager, Visual Studio and .NET
@nickuhlenhuth

Nick Uhlenhuth is a Program Manager on the Visual Studio team responsible for C++ IntelliSense and Productivity features.

Visual Studio 2017 version 15.8

$
0
0

Today we are releasing Visual Studio 2017 version 15.8. In this version we have focused on productivity, performance and bug fixes. There are many new features you‘ll find useful, but in this post, I’ll underscore the highlights you may be most interested in. For the complete list of all the updates in today’s release, check out the Visual Studio 2017 version 15.8 release notes and list of bugs submitted by you that are fixed. If you prefer to first try these updates without installing the release, check out the Visual Studio images in Azure.

A couple of notable additions to try:

  • Multi-caret editing improvements
  • Faster git branch switching
  • Faster unit test execution
  • TypeScript 3.0 support

Read on for more details.

Productivity

This release adds notable productivity and debugging enhancers.

Multi-caret editing. Editing multiple locations in a file, simultaneously, is now easy. Start by creating insertion points and selections at multiple locations in a file with multiple caret support. This will then allow you to add, edit, or delete text in multiple places simultaneously.

  • Insert carets with Ctrl + Alt + LeftMouseClick
  • Add a selection and caret at next location that matches current selection with Shift + Alt + Ins.
  • See Edit > Multiple Carets for full list of actions.

Contextual Navigation. You can now access a contextual navigation menu with the shortcut Alt + `.

New keybinding profiles for Visual Studio Code and ReSharper (Visual Studio). Speaking of shortcuts, you can now keep your keybindings consistent with two new keyboard profiles: Visual Studio Code and ReSharper (Visual Studio). You can find these schemes under Tools > Options > General > Keyboard and the top drop-down menu.

Keyboard mappings

New commands and improvements to the Go To All window:

  • Go to Enclosing Block (Ctrl + Alt + UpArrow) allows you to quickly navigate up to the beginning of the enclosing code block.
  • Go to Next/Previous Issue (Alt + PgUp/PgDn) allows you to skip to the next/previous issue (error, squiggle, lightbulb).
  • Go to Member (Ctrl + T, M) is now scoped to the file by default. You can change the default back to solution by toggling the Scope to Current Document (Ctrl + Alt + C).

And… more refactorings and quick actions using Ctrl + . or Alt + Enter:

  • Invert If enables you to invert your logic in if-else statements. Place your cursor in the if keyword to trigger this refactoring.
  • Add parameter from method callsite allows you to add a parameter to a method by adding an argument to a method callsite and triggering Quick Actions and Refactorings.
  • Remove unnecessary parentheses removes parentheses around binary operators that are not essential for compilation. You can configure this style rule through Tools > Options > Text Editor > C# > Code Style > General or .editorconfig:
    • dotnet_style_parentheses_in_arithmetic_binary_operators
    • dotnet_style_parentheses_in_relational_binary_operators
    • dotnet_style_parentheses_in_other_binary_operators
    • dotnet_style_parentheses_in_other_operators
  • Use ternary conditionals in assignments and return statements can also be configured as a style rule in Tools > Options > or through .editorconfig:
    • dotnet_style_prefer_conditional_expression_over_assignment
    • dotnet_style_prefer_conditional_expression_over_return

Select develop vs Debug instance of Visual Studio. When you have more than one instance of Visual Studio 2017 installed, you can now select which instance to deploy your extension to when debugging. That way you can, for example, develop in Visual Studio release channel while debugging in the preview channel.

Performance

In this release we have continued to focus on performance and have made significant improvements in many areas.

Git branch checkout and branch switching. Git branch checkout and branch switching for C#, VB, and C++ projects is much faster for large solutions since solution reload is no longer required.

Option to not reopen docs from previous session. We got feedback on how in some cases when Visual Studio reopened documents from previous sessions it wasn’t required, and that it would cause perf delays. So in this release we added an option to disable reopening documents that were open in the previous session. You can toggle this option in Tools > Options > Projects > Solutions > General.

Test performance. We significantly improved performance when running a few tests in a large solution with multiple test projects. In our lab, a solution with over 10,000 MSTests executed a single test up to 82% faster!

CPU Usage Tools performance improvements. We have a few notable improvements to highlight regarding the CPU Usage Tool. The CPU Usage tool in the Performance Profiler (ALT-F2) can now start in a paused state, which means that it will not collect any CPU usage sample stack data until it is specifically enabled. This makes the resultant amount of data much smaller to collect and analyze, in turn making your performance investigations more efficient. Once you start the target application, a monitoring display will show the CPU utilization graph and will allow you to control the CPU profiling and enable/disable sample data collection as many times as you like.

Pause / Resume Collection of CPU Usage Data

.NET Object Allocation Tracking Tool. The .NET Object Allocation Tracking Tool joins the family of tools available from the Performance Profiler (ALT-F2). Invoking this tool for a performance profiler session causes the collection of a stack trace for every .NET object allocation that occurs in the target application. This stack data is analyzed along with object type and size information to reveal details of the memory activity of your application. You can quickly determine the allocation patterns in your code and identify anomalies as well. In addition, for Garbage Collection events, you can easily determine which objects were collected and which were retained, quickly determining object types which dominate the memory usage of your application. This is especially useful for API writers to help minimize allocations. While your test application is executing, the Performance Profiler displays a monitoring view with a line graph of Live Objects (count), as well as an Object Delta (% change) bar graph.

The .NET Object Allocation Tracking Tool

C++ Development

C++11 standards conformance. A new, experimental, token-based preprocessor that conforms to C++11 standards (including C99 preprocessor features), enabled with /experimental:preprocessor switch. This will be controlled with macro _MSVC_TRADITIONAL, which will be defined to 1 when using the traditional preprocessor and 0 when using the new experimental standards conformant preprocessor.

CMake. Adding configurations to CMakeSettings.json is now as simple as selecting a template.

C++ Just My Code. C++ Just My Code debugging enables you now to step-over code from system or 3rd party C++ libraries in addition to collapsing those calls in the call-stack window. You get to control this behavior for any C++ libraries when your code is compiled with /JMC (the default for Debug configurations) and the non-user libraries paths are specified in a .natjmc file. If the system library calls into user-code, when you step in, the debugger will skip all system code and will stop on the first line of user-code callback.

Code analysis experience. Code analysis can now run in the background when files are opened or saved, and results will be displayed in the error list and as green squiggles in the editor. You can enable the new, in-progress features under Tools > Options > Text Editor > C++ > Experimental > Code Analysis.

Code analysis results displayed in the error list and as green squiggles in the editor

F# 4.5 and F# Tools for Visual Studio

F# language version 4.5. In this release we are introducing the F# language version 4.5. This also corresponds with the new 4.5.x family of FSharp.Core (the F# core library). With this come many improvements to the F# compiler. You can read the specs for each of these changes in the F# RFC repository.

F# Tools for Visual Studio. Some notable improvements include IntelliSense performance, transactional brace completion, an experimental CodeLens implementation, and may bug fixes contributed by the community. A community-driven effort to analyze and improve IntelliSense performance for very large files was contributed by Vasily Kirichenko, Steffen Forkmann, and Gauthier Segay. IntelliSense in very large files (10k+ lines of code) is roughly twice as fast now. Automatic, transactional brace completion is now available for (), [], {}, [||], and [<>] brace pairs. We did this work in collaboration with Gibran Rosa. There is now an experimental CodeLens implementation, contributed by Victor Peter Rouven Müller. You can turn it on in Options > Text Editor > F# > Code Lens. Check out the release notes to see the many other bug fixes and improvements to F# Tools for Visual Studio with this release.

JavaScript and TypeScript Tooling

TypeScript 3.0. This version of Visual Studio includes TypeScript 3.0 by default.

Support for the Vue.js library has been improved, and in particular support for .vue files, also known as “single file components”. If the Node.js workload is installed, there will now be “Basic Vue.js Web Application” templates under the “JavaScript / Node.js” or “TypeScript / Node.js” paths in the New Project dialog. The below shows an example of editing TypeScript code inside a script block in a .vue file.

ESLint support. ESLint support has been reimplemented in this release. So, Visual Studio will now lint JavaScript files as you edit. ESLint has been updated to use ESLint 4 by default, but if your project has a local installation of ESLint, it will use that version instead. You can easi;y disable ESLint globally in VS by unchecking the “Enable ESLint” setting in the “Tools / Options” dialog in the location shown below.

Check out the TypeScript 3.0 release announcement for all the details.

Visual Studio Web Tools

Library Manager. Library Manager is a new feature included in Visual Studio 2017. It helps you manage client-side libraries in your web projects.

Single project Docker Container. We added a new single project Docker container experience for ASP.NET Core web projects. This supplements the existing Docker Compose-based container tooling and provides a simpler, easier way to create, debug, and build Docker containers right from Visual Studio.

Mobile Development for Android

Support for Google Android Emulator. This release adds support for the Google Android emulator that is compatible with Hyper-V when running on the Windows 10 April 2018 Update. This enables you to use Google’s Android emulator side-by-side with other Hyper-V based technologies, including Hyper-V virtual machines, Docker tooling, the HoloLens emulator, and more. Mobile app developers who use Hyper-V now have access to a fast Android emulator that always supports the latest Android APIs, works with Google Play Services out of the box, and supports all features of the Android emulator, including camera, geolocation, and Quick Boot.

Keyboard mappings

Xamarin.Android Designer. We made significant improvements to the designer experience for Xamarin.Android. The highlight being, a split-view editor was introduced which allows you to create, edit, and preview your layouts at the same time

Keyboard mappings

.NET and ASP.NET

.NET Core SDK 2.1.400. Visual Studio 15.8 includes .NET Core SDK 2.1.400. New SDK features include added NUnit templates, added support for signed global tools, and improved help text for better clarity

ASP.NET .NET Framework Secrets Support. For ASP.NET, .NET Framework projects that target .NET Framework 4.7.1 or higher, you can now open and store secrets you do not want in your source code in usersecrets.xml by right clicking on the project and selecting “Managed User Secrets”.

.NET Framework 4.7.2. Visual Studio 2017 version 15.8 now offers the .NET Framework 4.7.2 development tools to all supported platforms with the 4.7.2 runtime included. The .NET Framework 4.7.2 offers several new features and improvements as well as numerous reliability, stability, security, and performance fixes. You can find more details about the .NET Framework 4.7.2 in these articles:

Share Your Feedback

As always, we want to know what you think. Please install Visual Studio 2017 version 15.8 and share your thoughts and concerns.

Please let us know any issues you have via the Report a Problem tool in Visual Studio. You can track your issues in Visual Studio Developer Community where you can ask questions and find answers. You can also engage with us and other Visual Studio developers through our new Gitter community (requires GitHub account), make a product suggestion through UserVoice, or get free installation help through Live Chat Support.

Thanks,

John

John Montgomery, Director of Program Management for Visual Studio
@JohnMont

John is responsible for product design and customer success for all of Visual Studio, C++, C#, VB, JavaScript, and .NET. John has been at Microsoft for 17 years, working in developer technologies the whole time.

Save with the Unity Pro & Visual Studio Professional Bundle

$
0
0

The combination of Visual Studio and Unity provides a top-notch experience for game development across a variety of platforms and devices. While we offer no cost software for those just starting out, as your team’s size and success grows, so does the need for professional tools.

We’re happy to announce in partnership with Unity Technologies, you can save 10% (up to $270!) with the all-new Unity Pro & Visual Studio Professional Bundle*.

With the bundle you’ll not only get the Visual Studio Professional IDE, but also one year of access to Visual Studio Professional Standard Subscription that includes development/test use rights for Microsoft software, $50 in monthly Azure credits, and CodeLens in the IDE on PC which provides better insight into your team’s code. Unity Pro provides extended analytics, performance reporting, collaboration tools, access to a Unity Success Advisor, and so much more. This special bundle is available for developers on both PC and Mac and you can learn more at unity3d.com/vsbundle.

Visual Studio and Unity Bundle

Visual Studio and Unity: Seamless Integration

The Visual Studio and Unity integration enables you to be more productive and improve the developer inner loop. When working with scripts, you can use Visual Studio features like IntelliSense. You can also directly implement Unity API messages in MonoBehavior scripts and take advantage of the MonoBehavior wizard for adding method definitions. Visual Studio also enables you to view Unity scripts in the “Unity Project Explorer” and makes it easy to debug games with its powerful debugger. Ready to see your changes? Enable “Attach to Unity and Play” to automatically switch to the Unity editor and begin playback of your game.

Visual Studio and Unity - Seamless Integration

To learn more about game development with Unity in Visual Studio, check out our docs.

* Limited time offer, Visual Studio Professional Subscription valid for one year.
For purchase information and to learn more about the Unity Pro & Visual Studio Professional Bundle, visit unity3d.com/vsbundle.

Jb Evain, Principal Software Engineer Manager
@jbevain

Jb runs the Visual Studio Tools for Unity experience. He has a passion for developer tools and programming languages and has been working in developer technologies for over a decade.

Visual Studio for Mac version 7.6

$
0
0

Today we are announcing the release of Visual Studio for Mac version 7.6. Our focus with this release has been to improve product reliability in various areas, with a special focus on the code editing experience. We have also made several fixes that improve IDE performance. Finally, we’ve extended our support for Azure functions with the addition of new templates and the ability to publish your function to Azure from within the IDE.

This post highlights the major improvements in this release. To see the complete list of changes, check out the Visual Studio for Mac version 7.6 Release Notes. You can get started by downloading the new release or updating your existing install to the latest build available in the Stable channel.

Improving reliability of the Code Editor

We’ve focused our attention on improving the reliability of the code editor in Visual Studio for Mac and have addressed several issues with the code editor. In particular, we want to highlight the following fixes to issues many of you have reported:

Improving performance of the IDE

One of the top reported bugs in previous releases has been performance issues in the editor. Having a fast and reliable code editor is a fundamental part of any IDE and an important part of any developer’s workflow, so we’ve made some improvements in this area:

  • We improved tag-based classification for C# with PR #4740 by reusing existing Visual Studio for Windows code, which should improve typing performance in the editor.
  • We now support no-op restore of NuGet packages when opening a solution. This change speeds up NuGet restores on solution load.

We’ve also added many more small fixes that improve startup time and reduce memory consumption of the IDE.

Richer support for Azure Functions

Azure functions are a great way to quickly get up and running with a serverless function in just a few minutes. With this release, we have introduced new templates for you to choose from when creating your Azure Functions project:

New Project Dialog showing how to configure Azure Functions project

These new templates allow you to configure access rights, connection strings, and any other binding properties that are required to configure the function. For information on selecting a template, refer to the Available function templates guide.

Another major part of the Azure functions workflow that we are introducing with this release is publishing of functions from Visual Studio for Mac to the Azure Portal. To publish a function, simply right-click on the project name and select Publish > Publish to Azure. You’ll then be able to publish to an existing Azure App Service or use the publishing wizard to create a new one:

New App Service Dialog showing how to create new app service on Azure

For information on publishing to Azure from Visual Studio for Mac, see the Publishing to Azure guide.

Share your Feedback

Addressing reliability and performance issues in Visual Studio for Mac remains our top priority. Your feedback is extremely important to us and helps us prioritize the issues that are most impacting your workflow. There are several ways that you can reach out to us:

  • Use the Report a Problem tool in Visual Studio for Mac.
    • We are enhancing the Report a Problem experience by allowing you to report a problem without leaving the IDE. You’ll have the ability to automatically include additional information, such as crash logs, that will help our Engineering team narrow down the root cause of your report more effectively. This will be introduced in an upcoming servicing release to 7.6 that will be available in the Stable channel within the next few weeks.
  • You can track your issues on the Visual Studio Developer Community portal where you can ask questions and find answers.
  • In addition to filing issues, you can also add your vote or comment on existing issues. This helps us assess the impact of the issue.
Dominic Nahous, Senior PM Manager, Visual Studio for Mac
@VisualStudio

Dominic works as a PM manager on Visual Studio for Mac. His team focuses on ensuring a delightful experience for developers using a Mac to build apps.


Improving your productivity in the Visual Studio Editor

$
0
0

Over the last few updates to Visual Studio 2017, we’ve been hard at work adding new features to boost your productivity while you’re writing code. Many of these are the result of your direct feedback coming from the UserVoice requests, Developer Community tickets, and direct feedback we’ve encountered while talking to developers like you.

We are so excited to share these features with you and look forward to your feedback!

Multi-Caret Support

One of our top UserVoice items asked for the ability to create multiple insertion and selection points, often shortened to be called multi-caret or multi-cursor support. Visual Studio Code users told us they missed this feature when working in Visual Studio. We heard you opened single files in Visual Studio Code to leverage this feature or installed extensions such as MixEdit, but in Visual Studio 2017 Version 15.8, you won’t need to do this anymore. We’ve added native support for some of the top requested features in the multi-caret family and we’re just getting started.

There are three main features we’d like to highlight. First, you can add multiple insertion points or carets. With Ctrl + Alt + Click, you can add additional carets to your document, which allows you to add or delete text in multiple places at once.

GIF showing how to add carets in multiple locations

Second, with Ctrl + Alt + . you can add additional selections that match your current selection. We think of this as an alternative to find and replace, as it allows you to add your matching selections one by one while also verifying the context of each additional selection. If you’d like to skip over a match, use (Ctrl + Shift + Alt + .) to move the last matching selection to the next instance.

Lastly, you can also grab all matching selections in a document at once (Ctrl + Alt + Shift + ,) providing a scoped find and replace all.

Quick Commands

Just like papercuts, smaller missing commands hurt when you add them up! We heard your pain, so in the past few releases, we’ve tried to address some of the top features you’ve asked for.

Duplicate line

The reduction of even a single keystroke adds up when multiplied across our userbase and one place we saw an opportunity to optimize your workflow was in duplicating code. The classic Copy + Paste worked in many cases, but we also heard in feedback that you wanted a way to duplicate a selection without affecting your clipboard. One scenario where this often popped up was when you wanted to clone a method and rename it by pasting a name you had previously copied.

To solve this issue, we introduced Duplicate Code (Ctrl + D) in Visual Studio 2017 version 15.6 which streamlines the process of duplicating your code while leaving your clipboard untouched. If nothing is selected, Ctrl + D will duplicate the line the cursor is in and insert it right below the line in focus. If you’d like to duplicate a specific set of code, simply select the portion of code you want to duplicate before invoking the duplicate code command.

Expand/Contract Selection

How do you quickly select a code block? In the past, you could incrementally add to your selection word by word or perhaps you used a series of Shift plus arrow keystrokes. Maybe you took that extra second to lift you hand off the keyboard so you could use a mouse instead. Whatever the way, you wanted something better. In Visual Studio 2017 version 15.5, we introduced expand /contract selection which allows you to grow your selection to the next logical code block (Shift + Alt + +) and decrease it by the same block if you happen to select too much (Shift + Alt + ).

gif showing expand /contract selection which allows you to grow your selection to the next logical code block and decrease it by the same block

Moving between issues in your document

You’ve been able to navigate to Next Error via Ctrl + Shift + F12 but we heard this experience was sometimes jarring as Next Error might jump you all around a solution as it progressed through issues in the order they appeared in the Error List. With Next/Previous Issue (Alt + PgUp/PgDn) you can navigate to the next issue (error, warning, suggestion) in the current document. This allows you to move between issues in sequential versus severity order and gives you more progressive context as you’re moving through your issues.

Go To All – Recent Files and File Member search

You can now view and prioritize search results from recent files. When you turn on the recent files filter, the Go To All results will show you a list of files opened during that session and then prioritizes results from recent files for your search term.

Additionally, Go To Member is now scoped to the current file by default. You can toggle this default scope back to solution level by turning off Scope to Current Document (Ctrl + Alt + C).

Go To Last Edited Location

We all know the feeling of starting to write a feature and then realizing we need some more information from elsewhere in the solution. So, we open another file from Solution Explorer or Go to Definition in a few places and suddenly, we’re far off from where we started with no easy way back unless you remember the name of file you were working in originally. In Visual Studio 2017 version 15.8, you can now go back to your last edited location via Edit > Go To > Go To Last Edit Location (Ctrl + Shift + Backspace).

Expanded Navigation Context Menu

Keyboard profiles for Visual Studio Code and ReSharper

Learning keyboard shortcuts takes time and builds up specific muscle memory so that once you learn one set, it can be difficult to retrain yourself when the shortcuts change or create mappings that match your previous shortcuts. This problem came to light as we heard from users who frequently switch between Visual Studio and Visual Studio Code, and those who used ReSharper in the past. To help, we’ve added two new keyboard profiles, Visual Studio Code and ReSharper (Visual Studio), which we hope will increase your productivity in Visual Studio.

Keyboard profiles for Visual Studio Code and ReSharper

C# Code Clean-up

Last, but certainly not least, in Visual Studio 2017 version 15.8, we’ve configured Format Document to perform additional code cleanup on a file–like remove and sort usings or apply code style preferences. Code cleanup will respect settings configured in an .editorconfig file, or lacking that rule or file, those set in Tools > Options > Text Editor > C# > [Code Style & Formatting]. Rules configured as none in an .editorconfig will not participate in code cleanup and will have to be individually fixed via the Quick Actions and Refactorings menu.

Options dialog showing format document options for C# Code Clean-up

Update and Give Feedback

With Visual Studio Version 15.8, you’ll have access to all the features above and more so be sure to update to take advantage of everything Visual Studio has to offer.

As you test out these new features, use the Send Feedback button inside Visual Studio to provide direct feedback to the product team. This can be anything from an issue you’re encountering or a request for a new productivity feature. We want to hear all of it so we can build the best Visual Studio for you!

Allison Buchholtz-Au, Program Manager, Visual Studio Platform

Allison is a Program Manager on the Visual Studio Platform team, focusing on streamlining source control workflows and supporting both our first and third party source control providers.

Visual Studio 2017 version 15.9 Preview 2

$
0
0

Today, we are releasing the second preview of Visual Studio 2017 version 15.9, and it can be downloaded here. This latest preview contains new features and improvements to Universal Windows Platform development, C++ debugging, and export installation settings. Read more in the feature highlight summary below and check out the Visual Studio 2017 version 15.9 Preview 2 release notes for more details on all the new, exciting features contained in this Preview.

Universal Windows Platform Development

In Visual Studio 2017 version 15.9 preview 2, we have a combination of new features and product enhancements for Universal Windows Platform developers. Read below to see what’s new!

Latest Windows 10 Insider Preview SDK: The most recent Windows 10 Insider Preview SDK (build 17754) is now included as an optional component for the Universal Windows Platform development workload. UWP developers can install this SDK to access the latest APIs available in the upcoming release of Windows 10.

Visual Studio Installer showing Windows 10 Preview SDK as optional

MSIX Package Creation: You can now create .MSIX packages in Visual Studio either through the Universal Windows Platform packaging tooling or through the Windows Application Packaging Project template. To generate a .MSIX package, set your Minimum Version to the latest Windows 10 Insider Preview SDK (build 17754), and then follow the standard package creation workflow in Visual Studio. To learn more about .MSIX packaging, check out this Build talk.

F5 Performance Improvements: We have optimized our F5 (build and deploy) tooling for faster developer productivity with UWP development. These improvements will be most noticeable for developers that target a remote PC using Windows authentication; but, all other deployment types should see improved performance as well.

UWP XAML Designer Reliability: For developers building UWP applications with a target version of Fall Creators Update (build 16299) or higher, you should notice fewer XAML designer crashes. Specifically, when the designer tries to render controls that throw with catchable exceptions, the rendered control will be replaced with a fallback control rather than crashing the design surface. These fallback controls will have a yellow border (shown below) to indicate to developers that the control has been replaced.

Fallback controls shown with yellow border

Step Back in the C++ Debugger

In Preview 2, we’ve added “Step Back” for C++ developers targeting Windows. With this feature, you can now return to a previous state while debugging without having to restart the entire process. It’s installed, but set to “off” by default as part of the C++ workload. To enable it, go to Tools -> Options -> IntelliTrace and select the “IntelliTrace snapshots” option. This will enable snapshots for both Managed and Native code.

Tools Options Dialog showing IntelliTrace snapshots option

Once “Step Back” is enabled, you will see snapshots appear in the Events tab of the Diagnostic Tools Window when you are stepping through C++ code.

Diagnostics Tools Window showing Once snapshots in events tab when Step Back is enabled when stepping through C code.

Clicking on any event will take you back to its respective snapshot. Or, you can simply use the Step Backward button on the debug command bar to go back in time. You can see “Step Back” in action in concurrence with “Step Over” in the gif below.

Gif showing Step Over and Step Backward

Acquisition

We’ve made it easier to keep your installation settings consistent across multiple installations of Visual Studio. You can now use the Visual Studio Installer to export a .vsconfig file for a given instance of Visual Studio. This file will contain information about the workloads and components you have installed. You can then import this file to add your workload and component selections to a new or existing installation of Visual Studio.

Dialog showing option to export a vsconfig file and also import it to add your workload configuration to a new or existing Visual Studio installation

Try out the Preview

If you’re not familiar with Visual Studio Previews, take a moment to read the Visual Studio 2017 Release Rhythm. Remember that Visual Studio 2017 Previews can be installed side-by-side with other versions of Visual Studio and other installs of Visual Studio 2017 without adversely affecting either your machine or your productivity. Previews provide an opportunity for you to receive fixes faster and try out upcoming functionality before they become mainstream. Similarly, the Previews enable the Visual Studio engineering team to validate usage, incorporate suggestions, and detect flaws earlier in the development process. We are highly responsive to feedback coming in through the Previews and look forward to hearing from you.

Please get the Visual Studio Preview today, exercise your favorite workloads, and tell us what you think. If you have an Azure subscription, you can provision virtual machine of this preview. You can report issues to us via the Report a Problem tool in Visual Studio or you can share a suggestion on UserVoice. You’ll be able to track your issues in the Visual Studio Developer Community where you can ask questions and find answers. You can also engage with us and other Visual Studio developers through our Visual Studio conversation in the Gitter community (requires GitHub account). Thank you for using the Visual Studio Previews.

Angel Zhou Program Manager, Visual Studio

Angel Zhou is a program manager on the Visual Studio release engineering team, which is responsible for making Visual Studio releases available to our customers around the world.

How can I pause my code in Visual Studio? Breakpoints FAQ

$
0
0

Have you ever found a bug in your code and wanted to pause code execution to inspect the problem? If you are a developer, there’s a strong chance you have experienced or will experience this issue many, many times. While the short and sweet answer to this problem is to use a breakpoint, the longer answer is that Visual Studio actually provides multiple kinds of breakpoints and methods that let you pause your code depending on the context! Based on the different scenarios you may experience while debugging, here are some of the various ways to pause your code and set or manage a breakpoint in Visual Studio 2017:

While my app is running, how can I pause to inspect a line of code that may contain a bug?

The easiest way to pause or “break” execution to inspect a line of code is to use a breakpoint, a tool that allows you to run your code up to a specified line before stopping. Breakpoints are an essential aspect of debugging, which is the process of detecting and removing errors and bugs from your code.

  1. Select the left margin or press F9 next to the line of code you would like to stop at.
  2. Run your code or hit Continue (F5) and your program will pause prior to execution at the location you marked.

Basic Breakpoint

Where can I manage and keep track of all my breakpoints?

If you have set multiple breakpoints located in different areas or files of your project, it can be hard to find and keep track of them. The Breakpoints Window is a central location where you can view, add, delete, and label your breakpoints. If it’s not already visible, this window can be accessed by navigating to the top tool bar in Visual Studio and selecting Debug –> Window –> Breakpoints (or CTRL + ALT + B).

Breakpoints Window

How can I stop execution only when my application reaches a specific state?

Conditional Breakpoints are an extended feature of regular breakpoints that allow you to control where and when a breakpoint executes by using conditional logic. If it’s difficult or time-consuming to manually recreate a particular state in your application to inspect a bug, conditional breakpoints are a good way to mitigate that process. Conditional breakpoints are also useful for determining the state in your application where a variable is storing incorrect data. To create a conditional breakpoint:

  1. Set a breakpoint on the desired line.
  2. Hover over the breakpoint and select the Settings gear icon that appears.
  3. Check the Conditions option. Make sure the first dropdown is set to Conditional Statement.
  4. Input valid conditional logic for when you want the break to occur and hit enter to save the breakpoint.

Conditional Breakpoint

How can I break a loop at a certain iteration when debugging?

You can select the Hit Count option when creating a conditional breakpoint (see above) to specify a specific loop iteration where you want to halt your code. Instead of having to manually step through each iteration, you can use hit count to break at the relevant iteration where your code starts misbehaving.

Hit Count

How can I break at the start of a function that I know the name of but not its location in my code?

Though a standard breakpoint can be used here, function breakpoints can also be used to break at the start of a function call. Function breakpoints can be used over other breakpoints when you know the function’s name but not its location in code. If you have multiple overloaded methods or a function contained within several different projects, function breakpoints are a good way to avoid having to manually set a breakpoint at each function call location. To create a function breakpoint:

  1. Select Debug –> New Breakpoint –> Break at Function.
  2. Input the desired function name and hit enter. These breakpoints can also be created and viewed via the Breakpoints Window.

Functional Breakpoint

How can I break only when a specific object’s property or value changes?

If you are debugging in C++, data breakpoints can be used to stop execution when a particular variable stored at a specific memory address changes. Exclusive to C++, these can be set via the Watch Window or the Breakpoints Window. For more info on data breakpoints, check out this blog post on Data Breakpoints in Visual Studio 2017 version 15.8.

Data Breakpoints

If you are debugging managed code, a current workaround and equivalent alternative to data breakpoints is to use an Object ID with a conditional breakpoint. To perform this task:

  1. In break mode, right click on the desired object and select Make Object ID, which will give you a handle to that object in memory.
  2. Add a conditional breakpoint to the desired setter where the conditional statement is “this == $[insert handle here].”
  3. Press Continue (F5) and you will now break in the setter when that particular property value changes for the desired instance.
  4. In the Call Stack, double click on the previous frame to view the line of code that is changing the specific object’s property.

ObjectID Setter Break

How can I break when a handled or unhandled exception is thrown?

When exceptions are thrown at runtime, you are typically given a message about it in the console window and/or browser, but you would then have to set your own breakpoints to debug the issue. However, Visual Studio also allows you to break when a specified exception is thrown automatically, regardless of whether it is being handled or not.

You can configure which thrown exceptions will break execution in the Exception Settings window.

Exception Break

Can I set a breakpoint in the call stack?

If you are using the call stack to examine your application’s execution flow or view function calls currently on the stack, you may want to use call stack breakpoints to pause execution at the line where a calling function returns.

  1. Open the call stack (Debug –> Windows –> Call Stack, or CTRL + ALT + C)
  2. In the call stack, right-click on the calling function and select Breakpoint –> Insert Breakpoint (F9).

CallStack Breakpoint

How can I pause execution at a specific assembly instruction?

If you are examining the disassembly window to inspect method efficiency, inexplainable debugger behavior, or you just want to study how your code works behind the scenes when translated into assembly code, disassembly breakpoints may be useful to you. Disassembly breakpoints can be used to break at a specific line of assembly code, accessible only when code execution is already paused. To place a disassembly breakpoint:

  1. Open the disassembly window (Debug –> Windows –> Disassembly, or Ctrl + Alt + D)
  2. Click in the left margin at the line you want to break at (or press F9).

Disassembly Breakpoint

Excited to try out any of these breakpoints? Let us know in the comments!

For more info on Visual Studio 2017 breakpoints, check out the official documentation. For any issues or suggestions, please let us know via Help > Send Feedback > Report a Problem in the IDE.

Leslie Richardson Program Manager, Visual Studio Debugging & Diagnostics

Leslie is a Program Manager on the Visual Studio Debugging and Diagnostics team, focusing primarily on improving the overall debugging experience and feature set.

Getting started writing Visual Studio extensions

$
0
0

I’m often asked how to best learn to build Visual Studio extensions, so here is what I wished someone told me before I got started.

Don’t skip the introduction

It’s easy to create a new extensibility project in Visual Studio, but unless you understand the basics of how the extensibility system works, then you are setting yourself up for failure.

The best introduction I know of is a session from //build 2016 and it is as relevant today as it was then.

Know the resources

Where do you get more information about the various aspects of the Visual Studio APIs you wish to use? Here are some very helpful websites that are good to study.

Know how to search for help

Writing extensions is a bit of a niche activity so searching for help online doesn’t always return relevant results. However, there are ways we can optimize our search terms to generate better results.

  • Use the precise interface and class names as part of the search term
  • Try adding the words VSIX, VSSDK or Visual Studio to the search terms
  • Search directly on GitHub instead of Google/Bing when possible
  • Ask questions to other extenders on the Gitter.im chatroom

Use open source as a learning tool

You probably have ideas about what you want your extension to do and how it should work. But what APIs should you use and how do you hook it all up correctly? These are difficult questions and a lot of people give up when these go unanswered.

The best way I know of is to find extensions on the Marketplace that does similar things or uses similar elements as to what you want to do. Then find the source code for that extension and look at what they did and what APIs they used and go from there.

Additional tools

There is an open source extension for Visual Studio that provides additional features for extension authors that I can highly recommend. Grab the Extensibility Essentials extension on the Marketplace.

Also, a NuGet package exist containing Roslyn Analyzers that will help you writing extensions. Add the Microsoft.VisualStudio.SDK.Analyzers package to your extension project.

I hope this will give you a better starting point for writing extensions. If I forgot to mention something, please let me know in the comments.

Mads Kristensen, Senior Program Manager
@mkristensenMads Kristensen is a senior program manager on the Visual Studio Extensibility team. He is passionate about extension authoring, and over the years, he’s written some of the most popular ones with millions of downloads.

How to upgrade extensions to support Visual Studio 2019

$
0
0

Recently, I’ve updated over 30 of my extensions to support Visual Studio 2019 (16.0). To make sure they work, I got my hands on a very early internal build of VS 2019 to test with (working on the Visual Studio team has its benefits). This upgrade process is one of the easiest I’ve ever experienced.

I wanted to share my steps with you to show just how easy it is so you’ll know what to do once Visual Studio 2019 is released.

Updates to .vsixmanifest

We need to make a couple of updates to the .vsixmanifest file. First, we must update the supported VS version range.

<InstallationTarget>

Here’s a version that support every major and minor versions of Visual Studio 14.0 (2015) and 15.0 (2017) all the way up to but not including version 16.0.

<Installation InstalledByMsi="false"> 
    <InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[14.0,16.0)" /> 
</Installation>

Simply change the upper bound of the version range from 16.0 to 17.0, like so:

<Installation InstalledByMsi="false"> 
    <InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[14.0,17.0)" /> 
</Installation>
<Prerequisite>

Next, update the version ranges in the <Prerequisite> elements. Here’s what it looked like before:

<Prerequisites> 
    <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,16.0)" DisplayName="Visual Studio core editor" /> 
</Prerequisites>

We must update the version ranges to have the same upper bound as before, but in this case we can make the upper bound open ended, like so:

<Prerequisites> 
    <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" DisplayName="Visual Studio core editor" /> 
</Prerequisites>

This means that the Prerequisite needs version 15.0 or newer.

See the updated .vsixmanifest files for Markdown Editor, Bundler & Minifier, and Image Optimizer.

Next Steps

Nothing. That’s it. You’re done.

Well, there is one thing that may affect your extension. Extensions that autoload a package has to do so in the background as stated in the blog post, Improving the responsiveness of critical scenarios by updating auto load behavior for extensions. You can also check out this walkthrough on how to update your extension to use the AsyncPackage if you haven’t already.

What about the references to Microsoft.VisualStudio.Shell and other such assemblies? As always with new version of Visual Studio, they are automatically being redirected to the 16.0 equivalent and there is backwards compatibility to ensure it will Just WorkTM.  And in my experience with the upgrade is that they in fact do just work.

I’m going to head back to adding VS 2019 support to the rest of my extensions. I’ve got about 40 left to go.

Mads Kristensen, Senior Program Manager
@mkristensenMads Kristensen is a senior program manager on the Visual Studio Extensibility team. He is passionate about extension authoring, and over the years, he’s written some of the most popular ones with millions of downloads.
Viewing all 1039 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>