Create a New C# Add-on in Visual Studio
You can create C# add-ons for Tacview using Visual Studio. In this tutorial we are using Visual Studio Community 2022.
Download and run the latest version of Tacview.
In Visual Studio, create a new Class Library (.NET framework) project:

Enter your project name, solution name, and location. Make sure you are targeting .NET Framework 4.7.2.

Click Create. A blank project will be created for you.

From C:\Program Files (x86)\Tacview\SDK\cs\, copy the folder Tacview.Wrapper into the folder of your new add-on:

Right-click on the solution to Add -> Existing Project. Find the Tacview.Wrapper in your add-on folder and add the project at project -> Windows -> Tacview.Wrapper.vcxproj

Right-click on your project and add a reference to the wrapper.

Make sure everything is configured to build as 64-bit target x64. Do not build for Any CPU.
The following is an example of a build configuration that should work if debugging in x64.

Copy the source code of the class DLL Interface from C:\Program Files (x86)\Tacview\SDK\cs\HelloWorld\HelloWorld.DllInterface.cs to your add-on.

Obtain the most recent version of DllExport.bat from this GitHub repository and place it in your add-on folder.

Close the solution, then run DllExport.bat in your add-on folder
You will be prompted to browse to the location of the solution of your add-on.

Make sure x64 is selected, tick the Installed checkbox next to your Add-on and Apply.

Reload your project.
Right-click on your Project and select Properties to set the Output Path equal to C:\ProgramData\Tacview\AddOns\YourAddOn\, so that Tacview can automatically find and load your DLL:

To debug your add-on, specify Tacview as the external program to start:

Troubleshooting
Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019
In the case that this error message appears in the Tacview Debug Log:
Make sure that you are not attempting to run a Debug version of this addon if you are not a developer. Debug builds require additional DLLs and tools.
First, use the link provided to download the latest version of Microsoft Visual C++ Redistributable for Visual Studio, even if you are sure that you have already downloaded everything your need. Close and re-launch Tacview.
If the error is still occurring it could be caused by the DLL having been compiled in Debug mode and now being run on a computer that is not set up for debugging. If you are the developer, be sure you are compiling the DLL in Release mode. If you are not the developer, please contact the developer.
When I debug or throw exceptions in a .NET add-on, Tacview crashes.
Make sure you are running at least Tacview 1.9.3, in which this issue is resolved. This issue occurs only on newer systems because it has to do with a security enhancement introduced in latest versions of Windows in combination with latest Intel and AMD processors.
Last updated