Including a batch file with VSIX

老子叫甜甜 提交于 2019-12-10 04:35:43

问题


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.


回答1:


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"




回答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



来源:https://stackoverflow.com/questions/25788656/including-a-batch-file-with-vsix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!