Linux C++ Workload improvements to the Project System, Linux Console Window, rsync and Attach to Process

点这里看中文版

In Visual Studio 2017 15.7 Preview 1 we have made a number of improvements to our support to the Linux C++ workload based on your feedback. You can learn more about our Linux C++ workload in Visual Studio here.

MSBuild Project System improvements

We added some new properties to Linux projects on the C/C++ General properties page. Max Parallel Compilation Jobs allows you to launch additional compilation processes. The default is 1 but can be increased to improve your build throughput. Public Project Include Directories allows you to specify directories in your project you want exposed to other projects in your solution. In the consuming project, add a reference to the project that exposed its include directories and now you can reference them from your source.

Linux Console Window improvements

Now on launch or debug of a Linux project the Linux console window will be displayed. If you dock this window the position will be remembered on subsequent launches. When you return from debug mode the window will be closed. We also fixed our handling of echo on/off to properly display messages from the remote system.

Rsync improvements for CMake and open folder

Our rsync support in open folder and CMake scenarios has also seen some improvements.  Previously rsync would run to completion even if you had cancelled the task that started it, this has been fixed. If rsync is triggered by a build for example and you cancel the build rsync will now cancel execution.  We’ve also made some performance improvements and enabled rsync with root users. You can also now pass additional command arguments to rsync using the rsyncCommandArgs option in CMakeSettings.json.

Attach to Process improvements

You have given us feedback regarding the need to have more control over the Attach to Process scenario for remote Linux debugging. We’ve added a lot of the controls that are possible through normal debug launch settings for Linux projects or Open Folder, such as enabling child process debugging, pre attach commands, etc. To enable this place a file named Microsoft.MIEngine.Options.xml in the root of your solution or workspace. Here is a simple example

<?xml version="1.0" encoding="utf-8"?>
<SupplementalLaunchOptions>
    <AttachOptions>
      <AttachOptionsForConnection AdditionalSOLibSearchPath="/home/user/solibs">
        <ServerOptions MIDebuggerPath="C:\Program Files (x86)\Microsoft Visual Studio\Preview\Enterprise\Common7\IDE\VC\Linux\bin\gdb\7.9\x86_64-linux-gnu-gdb.exe"
ExePath="C:\temp\ConsoleApplication17\ConsoleApplication17\bin\x64\Debug\ConsoleApplication17.out"/>
        <SetupCommands>
          <Command IgnoreFailures="true">-enable-pretty-printing</Command>
        </SetupCommands>
      </AttachOptionsForConnection>
    </AttachOptions>
</SupplementalLaunchOptions>

The AttachOptionsForConnection has most of the attributes you may need. The example above shows passing a location to search for additional .so libraries. The child element ServerOptions enables attaching to the remote process with gdbserver instead. To do that you need to specify a local gdb client (the one shipped in VS is shown above) and a local copy of the binary with symbols. The other child element SetupCommands allows you to pass commands directly to gdb. You can find all the options available in the LaunchOptions.xsd schema, look at the root element for this file of SupplementalLaunchOptions.

What’s next 

Download the Visual Studio 2017 Preview, install the Linux C++ Workload and give it a try with your projects.

The best way to reach us is via our GitHub hosted issue list, directly via mail at vcpplinux-support@microsoft.com or find me on Twitter @robotdad