Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including a batch file with VSIX

I'm trying to create a Visual Studio plugin, it's a menu item that executes batch files. I have no idea how to include the batch files (or any other additional files) with the VSIX when publishing so that they are available to all users that install the extension.

like image 905
GRaff Avatar asked Sep 11 '14 13:09

GRaff


People also ask

How do I install a VSIX file?

Extensions that have been packaged in . vsix files may be available in locations other than Visual Studio Marketplace. The Extensions > Manage Extensions dialog box can't detect these files, but you can install a . vsix file by double-clicking the file or selecting the file and pressing Enter.


2 Answers

In solution explorer right click on the batch file (in this case I called it BatchFile.cmd) and choose 'Properties'

In the properties window change:

Build Action: Content

Include in VSIX: True

When the solution is built in release mode it creates a VSIX file in the bin/Release folder. This is the package and it contains all the assets required. When the package is installed on another machine, the batch file is included in the install location and can be referenced using:

Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "BatchFile.cmd"

like image 124
GRaff Avatar answered Oct 18 '22 09:10

GRaff


You can just include the batch file as content in your project, and use GetAssembly() to find the location of your adin dll at runtime

like image 2
ErikEJ Avatar answered Oct 18 '22 07:10

ErikEJ