Skip to content

This is a Visual Studio Code extension that provides a (.sln) Visual Studio Solution explorer panel..

License

Notifications You must be signed in to change notification settings

badsyntax/vscode-solution-explorer

 
 

Repository files navigation

vscode-solution-explorer

This extension adds a Visual Studio Solution File explorer panel in Visual Studio Code. Now you can navigate into your solution following the original Visual Studio structure.

It was originally intended to work with .Net Core solutions and projects. And that is why support for other types of projects (such as .Net Framework or C++) is not guaranteed.

Visual Studio Code Solution Explorer Showcase

If you want to enjoy the full experience, you should install:

Table of Content:

If you like my work you can 🍺 buy me a beer and show that love 😁

Getting Started

To activate vscode-solution-explorer you have to first open a folder or workspace.

Then, you can find this extension displayed as:

  • a tab in the "Explorer" activity

Visual Studio Code Explorer tab

  • an activity with the Visual Studio icon

Visual Studio Code Activity

You can configure it in the Visual Studio Code settings panel, looking for "VsSolution: Show Mode" section:

Visual Studio Code Settings: Show Modes

Open Solutions

vscode-solution-explorer has several ways to open the solution files and you can configure them in the Visual Studio Code configuration panel.

Open Solution command

You can execute the "Open solution" command from the command palette or from the welcome view (if no solution has been found).

Open Solution Command

Omnisharp integration

You can enable omnisharp integration and vscode-solution-explorer will open the same .sln file you open with Microsoft extension.

Activate Omnisharp integration in settings panel

It will ignore .csproj files because vscode-solution-explorer cannot open a project file without a Solution.

You have to install Microsoft C# extension to enable omnisharp integration.

Find Solution files

You can use the automatic solution file finder activating some options in the Visual Studio Code settings panel.

Open Solution Command

The vssolution.openSolutions.inRootFolder setting will look for the solution files in the root folder.

inRootFolder

The vssolution.openSolutions.inFoldersAndSubfolders setting will search for the solution files in the root folder and its subfolders.

inFoldersAndSubfolders

And if you want to specify the subfolders where you want to look for the solution files you have to activate the vssolution.openSolutions.inAltFolders setting and specify the folders in the vssolution.altSolutionFolders setting:

inAltFolders

You can combine all of these options to find the best configuration for you.

Features

Adds a Solution Explorer panel where you can find a Visual Studio Solution File Explorer:

Run dotnet commands in solutions and projects

Only available when the project is of kind CPS (dotnet core).

  • Build: dotnet build
  • Clean: dotnet clean
  • New: dotnet new
  • Pack: dotnet pack
  • Publish: dotnet publish
  • Restore: dotnet restore
  • Run: dotnet run
  • Watch: dotnet watch run

Run dotnet commands in solutions and projects

If you want to customize the terminal commands you can change them in the settings json file. These are the default commands configuration:

{
  "vssolution.customCommands": {
    "addPackageReferenceToProject": [ "dotnet", "add", "\"$projectPath\"", "package", "\"$packageId\"" ],
    "addPackageReferenceToProjectWithVersion": [ "dotnet", "add", "\"$projectPath\"", "package", "\"$packageId\"", "-v", "\"$packageVersion\"" ],
    "addProjectReferenceToProject": [ "dotnet", "add", "\"$projectPath\"", "reference", "\"$referencedprojectPath\"" ],
    "build": [ "dotnet", "build", "\"$projectPath\"" ],
    "clean": [ "dotnet", "clean", "\"$projectPath\"" ],
    "createProject": [ "dotnet", "new", "\"$projectType\"", "-lang", "\"$language\"", "-n", "\"$projectName\"", "-o", "\"$folderName\"" ],
    "createSolution": [ "dotnet", "new", "sln", "-n", "\"$solutionName\"" ],
    "pack": [ "dotnet", "pack", "\"$projectPath\"" ],
    "publish": [ "dotnet", "publish", "\"$projectPath\"" ],
    "removeProjectFromSolution": [ "dotnet", "sln", "\"$solutionPath\"", "remove", "\"$projectPath\"" ],
    "removePackageReferenceFromProject": [ "dotnet", "remove", "\"$projectPath\"", "package", "\"$packageId\"" ],
    "removeProjectReferenceFromProject": [ "dotnet", "remove", "\"$projectPath\"", "reference", "\"$referencedprojectPath\"" ],
    "restore": [ "dotnet", "restore", "\"$projectPath\"" ],
    "run": [ "dotnet", "run", "--project", "\"$projectPath\"" ],
    "test": [ "dotnet", "test", "\"$projectPath\"" ],
    "watch": [ "dotnet", "watch", "run", "--project", "\"$projectPath\"" ]
  }
}

It will replace keywords like $solutionPath or $projectPath with the actual values.

As an example, if you want to compile in Release mode everytime you publish a project you can create somethink like:

{
  "vssolution.customCommands":  {
    "publish": [ "dotnet", "publish", "\"$projectPath\"", "-c", "Release" ]
  }
}

Drag and drop files, folders and projects

Drag and drop files, folders and projects

Create, delete, rename or project folders and files

Create, delete, rename or project folders and files

Create, delete, rename or move solution, solution folders and projects

Create, delete, rename or move solution, solution folders and projects

Add or remove nuget packages

Only available when the project is of kind CPS (dotnet core).

Add or remove nuget packages

If you want to use custom nuget feeds it will look for a file called nuget.config in the root folder of the project and its parent folders. If it finds this file, it will read the configuration and use it. If it does not find it, it will use the default nuget feed.

As an Example:

<configuration>
  <packageSources>
    <add key="Nuget.org" value="https://api.nuget.org/v3/index.json" />
    <add key="PrivateFeed" value="https://mydomain.com/myfeed/index.json" />
  </packageSources>
  <packageSourceCredentials>
	  <PrivateFeed>
	    <add key="Username" value="me@email.com" />
      <add key="ClearTextPassword" value="my_super_strong_password" />
	  </PrivateFeed>
  </packageSourceCredentials>
</configuration>

If you are working with /drive/path/to/project.csproj, it will look for:

  • /drive/path/to/nuget.config
  • /drive/path/nuget.config
  • /drivenuget.config
  • /nuget.config

Note vscode-solution-explorer only supports ClearTextPassword credencials in nuget.config

Update all nuget packages versions

Only available when the project is of kind CPS (dotnet core).

Update all nuget packages versions

Add or remove project references

Only available when the project is of kind CPS (dotnet core).

Add or remove project references

Create file templates

This extensions has a custom template system to create new files. When you create a new file you can select a template from the dropdown list:

Open Solution Command

You can customize the templates for your project. First of all click with the right mouse button on your solution file and select Install File Creation Templates. Then you have to move to .vscode/solution-explorer folder and you can find the file called template-list.json. This file contains the list of templates.

We strongly recommend you to update your templates after updating this extension:

Install Or Update templates

Extension Settings

You can configure the extension in the Visual Studio Code settings panel:

  • vssolution.showMode Show the solution explorer in the "activityBar", in the "explorer" pane or "none" to hide it. This feature is only for testing pourposes.

  • vssolution.solutionExplorerIcons "solution-explorer": custom items from vscode-solution-explorer extension. "mix": file and folder icons from the installed icons theme. "current-theme": all the icons are from the installed icons theme.

  • vssolution.showOutputChannel Show the solution explorer output channel.

  • vssolution.trackActiveItem Select the active editor file in the solution explorer (not recomended).

  • vssolution.itemNesting Sets whether related items will be displayed nested.

  • vssolution.netcoreIgnore Folder and file names to ignore when get a dotnet core project content.

  • vssolution.xxprojItemTypes Type of XML element to put in the xxproj files.

  • vssolution.xmlspaces Spaces to be used for indenting XML output. It could be a number or an string. ex. "2", " " or "t".

  • vssolution.altSolutionFolders If there is no solution in the workplace root folder, it will search for solutions in any of these folders.

  • vssolution.win32Encoding Win32 "codepage" to "iconv.js" encoding equivalences.

  • vssolution.customCommands Sets custom the terminal commands.

  • vssolution.openSolutions.inRootFolder Sets whether solutions will be automatically loaded from the root folder.

  • vssolution.openSolutions.inAltFolders Sets whether solutions will be automatically loaded from the vssolution.altSolutionFolders parameter.

  • vssolution.openSolutions.inFoldersAndSubfolders Sets whether solutions will be automatically loaded from the current opened folder and subfolders.

  • vssolution.openSolutions.selectedInOmnisharp Sets whether solutions will be automatically loaded from the current selected solution in Omnisharp extension.

Example
{
    "vssolution.showMode": "activityBar",

    "vssolution.solutionExplorerIcons": "current-theme",

    "vssolution.showOutputChannel": true,

    "vssolution.trackActiveItem": false,

    "vssolution.itemNesting": false,

    "vssolution.netcoreIgnore": [
        "bin",
        "node_modules",
        "obj",
        ".ds_store"
    ],

    "vssolution.xxprojItemTypes": {
        "*": "Content",
        "cs": "Compile",
        "cpp": "ClCompile",
        "cc": "ClCompile",
        "c": "ClCompile",
        "h": "ClInclude",
        "hpp": "ClInclude",
        "vb": "Compile",
        "fs": "Compile",
        "ts": "TypeScriptCompile"
    },

    "vssolution.xmlspaces": "2",

    "vssolution.altSolutionFolders": [
        "src"
    ],

    "vssolution.win32Encoding": {
        "932": "Shift_JIS",
        "936": "GBK",
        "950": "BIG5"
    },

    "vssolution.openSolutions.inRootFolder": false,
    "vssolution.openSolutions.inAltFolders": false,
    "vssolution.openSolutions.inFoldersAndSubfolders": false,
    "vssolution.openSolutions.selectedInOmnisharp": true
}

Known Issues

Please report your issues: vscode-solution-explorer GitHub page

License

The source code is licensed under the MIT license.

The icons from (vscode-icons extension) are licensed under the Creative Commons - ShareAlike (CC BY-SA) license.

Branded icons are licensed under their copyright license.

Thanks to contributors

dfrencham darkmfj mwpenny remcoros marawan31 emrahcetiner martinothamar jesperbjensen Dvvarf vthg2themax jloureiro09 jbactad vlesierse m4ss1m0g Coda Hongyang Du (hond) Callum Marshall Philippe Desmarais LesanOuO ShalokShalom nev-21 Enjoy!

About

This is a Visual Studio Code extension that provides a (.sln) Visual Studio Solution explorer panel..

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.9%
  • JavaScript 1.1%