Visual Studio Project
🔗 Original page — Source of this material
Description
This block is available starting from version 7.3.2.0
The “Visual Studio Project” action allows you to use a project created in Microsoft Visual Studio 2019 within a ZennoPoster project, opening up unlimited possibilities for writing, debugging code, and connecting external libraries.
How do I add this action to my project?
You can add it via the context menu: Add Action → Your Code → Visual Studio Project

Or use the ❗→ smart search.
What is this used for?
- Seamless integration of third-party libraries and their use in your code
- Creating your own libraries for reuse across different projects
How do I work with this action?
The “Visual Studio Project” action can work in two modes:
- Using a Visual Studio solution
- Using a Dll
In “Use Visual Studio Solution” mode, the block properties look like this:

Controls:
- Select the block’s operating mode
- Path to the solution containing the project
- The project that will run when the block is executed
- Project configuration
- Flag to merge output dll and dependencies into a single dll file using ILRepack
- Button to switch to “Use Dll” mode
- “Connect to Visual Studio” button
- “Create new Visual Studio project” button
In “Use Dll” mode, the block properties look like this:
Controls:
- Select the block’s operating mode
- Path to the dll that will be run when the block is executed
“Use Visual Studio Solution” mode
Creating a project and connecting to Visual Studio
To use this action in “Visual Studio Solution” mode, you must have:
- Visual Studio 2019 installed. You can download the free Community version from the official website: https://visualstudio.microsoft.com/ru/vs/community/
- The target platform for the project as .Net Framework 4.6.2 (Download .NET SDKs for Visual Studio (microsoft.com))
To create a project and connect to Visual Studio, follow these steps:
- Add the action and select the “Use Visual Studio Solution” mode
- Create a new project by clicking the “Create new Visual Studio project” (1) button
If you already have a project created, you can skip the following steps and simply select the solution, project, and configuration in the block’s properties and connect to Visual Studio using the “Connect to Visual Studio” (2) button.

- A window will appear where you need to enter the project name, location, and solution name, and then click “OK”

- This will start the process of creating the Visual Studio solution

- And then the process of connecting to Visual Studio will begin.

Connecting to Visual Studio provides interaction between Project Maker and Visual Studio. This interaction allows you to:
- Record actions from Project Maker’s browser directly into Visual Studio source code
- Debug the Visual Studio project with access to the Project Maker browser and project
- After connecting, the Project Maker browser window will open in Visual Studio. If it does not open automatically, you can access it via View→Other Windows→ZennoPosterToolWindow.

To connect to Visual Studio, you need the ZennoPosterVisualStudioExtension extension. It will be installed in Visual Studio automatically on the first connection.
If you don't see View→Other Windows→ZennoPosterToolWindow in the menu, the ZennoPosterVisualStudioExtension might not be installed or could be disabled. In Visual Studio, open Extensions→Manage Extensions, go to Installed, and check the status of ZennoPosterVisualStudioExtension. If it’s not installed, try restarting Project Maker and reconnecting to Visual Studio. If the problem persists, please contact technical support.
Working in Visual Studio, project structure
To make your project usable with this action, it needs to meet the following requirements (projects created via Project Maker meet all these requirements by default):
- Include references to ZennoPoster’s common libraries:
Global.dll,ZennoLab.CommandCenter.dll,ZennoLab.Emulation.dll,ZennoLab.InterfacesLibrary.dll. These libraries are in the ZennoPoster installation folder. - Contain a class that implements the
IZennoExternalCodeinterface. When code is executed, the methodpublic int Execute(Instance instance, IZennoPosterProjectModel project)will be called. It should return 0 on success or any other value for an error.
The automatically created project contains a single file, Program.cs, with the implementation of the Execute method.

Embedding the Project Maker browser in Visual Studio allows you to record actions directly into your source code. To enable/disable recording, click the "Record" button on the browser window’s toolbar.
To send the browser back to Project Maker, click the "Return to Project Maker" button.
When recording is enabled, entering a new URL in the browser creates a new action file named ActionGroupXXX.cs (XXX is the sequential action set number), and code to call this action is added to Program.cs.

To access the browser or the project from the Execute method, the instance and project objects are provided, and you can work with them as described in ❗→ C# code (.NET).
To debug your code, use the standard “Start” button in Visual Studio.
Using dll
To use this action in "Use dll" mode, you do NOT need Visual Studio installed. This mode lets you move a finished project between different computers. You just need to make sure all the required dlls are available on each computer (for example, copy them into the project folder).
After you finish developing your project in Visual Studio, you can quickly switch to directly using the output dll by clicking the "Use as dll" button
After you click that button, a window will open where you can choose what to do

- Build the solution (required step)
- Merge the output dll and libraries into a single dll file with ILRepack (reduces the number of files to transfer with the project)
- Copy the dll to the required path (by default, the project folder macro is used)
- Change the block’s mode to "Use as dll" and set the dll path
- Show the built dll in Explorer
You can also manually change the mode and set the desired dll path. To run the dll, it must contain a class implementing the IZennoExternalCode interface.
Possible errors and how to fix them
Project Target Framework Not Installed

This error means the .Net 4.6.2 developer pack is not installed. You need to download and install it from the official site: Download .NET SDKs for Visual Studio (microsoft.com)
Call was rejected by callee (RPC_E_CALL_REJECTED)

This error means Visual Studio is rejecting connection requests from ProjectMaker. This most often happens when you need to do something in Visual Studio (a dialog window might have appeared). Switch to Visual Studio and complete the required actions there. Then try connecting to Visual Studio again. If the error persists, restart Visual Studio. If this still doesn’t help, please contact technical support.
After connecting to Visual Studio, block property rendering works incorrectly
This problem looks like the following. Notice that when you click different blocks or blank spaces on the diagram, the block properties do not refresh correctly.

To resolve the issue, check your Visual Studio settings.
Russian version (Средства→Параметры…→Общие):

English version (Tools→Options…→General):

You can find a detailed explanation of this setting here: Per-Monitor support for Visual Studio extensions
If this option is unavailable, try updating Windows and Visual Studio, or follow the instructions for manually adding a registry key: