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 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 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
Vachan C Rannore · Oct 24

Hi Leo,

You can try this from the terminal.

Do$System.OBJ.Export("YourProject.prj", "C:\\Exports\\YourProject.xml")
0