Including a batch file with VSIX
Asked Answered
M

2

6

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.

Mealie answered 11/9, 2014 at 13:23 Comment(0)
M
12

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"

Mealie answered 12/9, 2014 at 15:42 Comment(1)
Thanks, it's a good one. What I like about it is that you can add the item as a link to the project and it will still get packaged in vsix.Bombshell
A
2

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

Amabil answered 11/9, 2014 at 18:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.