MATLAB File Association in Visual Studio 2015 / TFS

Wolfie

I'm using TFS in Visual Studio 2015, and have a question about MATLAB file associations. For .m files, there is no association to MATLAB, as seen here:

Function

Confusingly, there is an association for .fig and .mat files, so VS must recognise that MATLAB "exists". If I double click one of these file types, it opens it in MATLAB as it would from within an Explorer window. This is the behaviour I want for .m files.

Figure

As a minimum, I'd like to have the MATLAB icon for .m files so that they're easy to spot in a directory. As an ideal solution, these files would also open in MATLAB (not the VS text editor) from TFS.

I have tried the "File Extension" option inside of Options > Text Editor, but MATLAB isn't an option for me in the Editor list.

Options

It's worth noting that my work network is pretty strict on software installs, so the fewer external add-ins the better (ideally none). Suggestions appreciated.

Wolfie

So after a long time, I've found a reasonable workaround for this.

You can set the "Open With" default for .m files, but this seems to open a new instance of MATLAB for every file - not ideal! Suggested by SACn below their answer.


A better option is to use Visual Studio's "External Tools".

Go to Tools > External Tools, then as this documentation shows, create a new tool. Use the following parameters:

Title:     Your Title Here
Command:   cmd.exe
Arguments: /c "$(ItemPath)"

Tick "Close on exit". This opens the command prompt with the /c (terminate after command) flag, and runs the file name of the file which you have open in VS. On Windows systems, this will open the file in an open instance of MATLAB, or launch a new one if none exist.


This can be run many ways... Assign a keyboard shortcut, run from the Tools menu, add it to the Toolbar, add it to the context menu.

Now there is one click / key press to launch an open .m file as desired. It still lacks the MATLAB file association (and corresponding icon in the file browser) but does the main job!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Windows 10 Visual Studio 2015 .xaml file association

Where is TFS Build Explorer in Visual Studio 2015?

Visual Studio 2015. Files not added to TFS

Visual Studio 2015 - Check in to a different branch in TFS

Visual Studio 2013 and TFS Build 2015: Devenv.exe unable to produce MSI file

TFS / Visual Studio 2015 : how to compare file changes between 2 commits

TFS 2015 - XAML build progress inside Visual Studio 2015

TFS Build error after installing Visual Studio 2015 Update 1

Database project build errors in TFS with Visual Studio 2015 Update 3

MSSCCI provider for Visual Studio 2008 SP1 and TFS 2015

Running Visual Studio Load Test in TFS 2015 locally

Visual Studio Team Services/TFS 2015 Project Structure

TFS 2013 Build force MSBuild to use Visual Studio 2015

TFS 2015 -> 2017 Update1 Projects Not Showing In Visual Studio

Querying TFS 2015 Source Code Repository with Powershell and Visual Studio 2019

Custom TFS Check-In Policy in Visual Studio 2015

Cannot add files to Visual studio 2015 (Community) Update 3 / TFS

Visual Studio 2015 Code Coverage Wrong File

Launch exe file generated by Visual Studio 2015

The desired name for <file> is invalid - visual studio 2015

How to use a resource file in Visual Studio 2015

JSX and Typescript in the same file with Visual Studio 2015

Running a single .cpp file in Visual Studio 2015?

Create TFS Source Branch using Visual Studio Online / TFS 2015 Api

Get the running instance of VersionControlServer(tfs 2015) from Visual Studio 2015 to bind a GettingEventHandler to it

Visual Studio TFS - Prevent check-out if destination is not the latest file

Cannot edit checked out file (TFS) in Visual Studio 2013

TFS Visual Studio Test task not populating TRX file

glog on visual studio 2015