Written by

Developer at Healthy Reply
Question Pietro Di Leo · Jan 17, 2024

How to export a project via Visual Studio Code?

Hi everyone, 

Does anyone know how to export projects via VSC? 

I opened the project through the "InterSystems Tools" plugin (command is "Edit Code in Project") and I can correctly work on it.

However, when I try using the "ObjectScript" plugin to export the project (right click on the project -> "Export Project Contents")

This message appears and it is not possible to export the project:

I've tried also to open a new window, then a folder and finally the project, but nothing changes. 

This is an example of my workspace: 


Anyone knows how to do it? 

Thank you! 

Product version: IRIS 2021.1

Comments

Brett Saviano · Jan 17, 2024

@Pietro Di Leo 
When you say "export a project", what do you mean by that? Do you mean "export the documents in the project to edit them", or "export the contents as a single legacy XML file for deployment/sharing"?

0
Pietro Di Leo  Jan 17, 2024 to Brett Saviano

I would like to export the project as an XML file, as is it possible in Studio

0
Brett Saviano  Jan 17, 2024 to Pietro Di Leo

The "Export Project Contents" command that you clicked is for exporting as individual UDL files in your workspace for editing with local source control. To export server documents in a single XML file, you an use the "Export Documents to XML File..." command that's documented here.

0
Stephan Gertsobbe  Oct 24, 2025 to Brett Saviano

Hi Brett, Unfortunately, your answer is not fully satisfactory, as Export Documents to XML File... does not automatically export the project and all its content (at least not for me), and it doesn't fire the server-side studio extension hook "ExportProject" that in our case would automatically

* Check that the project contains all necessary classes and files by checking the content of about 1000 classes.

* Export the project's individual files for server-side source control into individual files.

* Export the entire project into a single XML file to be given away or as a backup of the project at a certain point in time.

Am I missing something, or is that very convenient method of automation not possible with the VS Code integration?

* Check that the project contains all necessary classes and files by checking the content of about 1000 classes.

* Export the project's individual files for server-side source control into individual files.

* Export the entire project into a single XML file to be given away or as a backup of the project at a certain point in time.

Am I missing something, or is that very convenient method of automation not possible with the VS Code integration?

Ah I forgot to mention ExportProject is in our case fired by "OnBeforeLoad" of any prj file and on OnAfterSave if an "prj" item saves. Unfortunately these two operations seem to never fire when working with projects in VS Code

0
Brett Saviano  Oct 24, 2025 to Stephan Gertsobbe

Hi @Stephan Gertsobbe, there is no exact equivalent for exporting an entire Studio project in a single XML file. The command I mentioned is the closest approximation. The best workaround is to use a terminal to do the export. Since you mentioned using these exports for backup and that you have server-side source control in use, I would expect that your files being tracked in source control would constitute the backup. 

Source control support for projects files themselves is limited due to the way we edit them. The Atelier REST API used by VS Code has no support for Studio Projects since the concept didn't exist in Atelier. VS Code uses SQL to modify projects instead. This mechanism was chosen for its backwards compatibility since Studio Projects users tended to be on older server versions. Source control UserActions are fired for projects, but not all of the lifecycle hooks will because we are not using object access. 

0
Tobias Krause  Dec 2, 2025 to Brett Saviano

I, in fact, do have the other use case where I want to export all contents of my project to my filesystem so that I am able to use local, client-side Git as VSC. But I always get the same error message "There are no folders in the current workspace ..." like reported by @Pietro Di Leo 

But my workspace has folders, so I don't understand what's missing to use this feature or if it is a bug.

@Brett Saviano do you have any suggestions for the use case?

I even took a look at the vs code extension sourcecode, but did not understand which exact conditions lead to the error message: https://github.com/intersystems-community/vscode-objectscript/blob/14bd…
 

0
Brett Saviano  Dec 2, 2025 to Tobias Krause

@Tobias Krause You need to have a workspace folder with an active server connection to the same server and namespace that you are trying to export from. These checks are there to prevent you accidentally syncing the exported files with a different server or namespace. 

0
Tobias Krause  Jan 30 to Brett Saviano

I just found a combination of vs code workspace configuration that worked! 🎉

You have to use a Multi-Root-Workspace with at least one folder in the local filesystem (usually the folder in which the .code-workspace file is stored) and at least one server-side virtual folder.
The later is necessary to enable the Project Explorer in the InterSystems view container, where you can select the "Export Project Contents" option.
AFAIK, this is the only way to execute this command in VS Code.

The feature "Export Project Content" now only works as expected, if (and in my experience only if) the  IRIS server connection is defined in the .code-workspace file of the current workspace.

{
  "folders": [
    {
      "name": "Local Root Folder""path": ".",
    },
    {
      "name": "Server Folder: local-iris:IRISAPP (read-only)",
      "uri": "isfs-readonly://local-iris:irisapp/?mapped=0&system=0",
    },
  ],
  "settings": {
    "intersystems.servers": {
      "local-iris": {
        "webServer": {
          "scheme": "http",
          "host": "localhost",
          "port": 52773,
        },
        "username": "_SYSTEM",
      },
    },
    "objectscript.conn": {
      "server": "local-iris",
      "ns": "IRISAPP",
      "active": true,
    },
  },
}

It won't work (as reported here and in other posts) if there is an active server connection that is defined in any other place, e.g. in .vscode/settings.json.

@Brett Saviano is this what you meant in your previous answer?
 

0
Vachan C Rannore · Oct 24, 2025

Hi Leo,

You can try this from the terminal.

Do$System.OBJ.Export("YourProject.prj", "C:\\Exports\\YourProject.xml")
0
Enrico Parisi  Jan 31 to Vachan C Rannore

@Vachan C Rannore, that's work for sure, BUT, the file will be exported in the IRIS SERVER filesystem, not "your" (where vscode is running) filesystem. In some environment you may not have (simple) access to the IRIS server filesystem.

The question is on exporting to your local machine, as usually done using Studio.

0
Pietro Di Leo  Feb 2 to Vachan C Rannore

Hi Vachan, thanks for your reply. Unfortunately we don't always have SSH access to our clients' machines, so this can't be applied. With this question I intended if there is anything in VSCode lke the Export Project feature in Studio. 

Currently, the only solution I've found is building a custom API to do this and a UI to interact with it, but it must be installed on the machine. 

0
John Murray  Feb 2 to Pietro Di Leo

You may be able to avoid having to install anything on the server by using the /action/query endpoint of the /api/atelier API to run a SQL query such as this:

SELECT
 p.Name ASProject,
 p.Description,
 pi.Name AS Component,
 pi.Type
FROM
 %Studio.Project AS p,
 %Studio.ProjectItem ASpiWHERE
 p.Name = pi.Project
ORDERBYProject,
 Component
0
Vachan C Rannore  Feb 4 to Pietro Di Leo

Great to know that you have built a custom API for this. Can you share with me how you are doing it?

0