如何将文件嵌入/包含到一个VSTO插件中

huangapple go评论76阅读模式
英文:

How to embed/include a file into a VSTO addin

问题

当我发布VSTO插件时,如何嵌入此工作簿,以便在安装VSTO插件时也安装/复制它?此外,如何访问此文件以及其安装位置?

英文:

I have a regular VSTO addin for excel(not the web addin). I have an excel file that I have included into my project, but fiddled with the file type and build properties.

The addin uses worksheets in this workbook as templates to create new worksheets.

I've set the file to copy always and that just copies it to the bin folder and not embed it into the VSTO installer when publishing.

When I publish the VSTO addin, how can I embed this workbook so that it is also installed/copied when the VSTO addin is installed? Also, how can I access this file in its installed location?

答案1

得分: 1

这取决于用于发布插件的安装程序选择。基本上,您有两种可能的方式:

  1. ClickOnce - 参见如何:指定ClickOnce发布的文件如何:在ClickOnce应用程序中包含数据文件
  2. MSI - 如果将Built Action属性设置为Content值,文件应该会自动添加到安装程序中。当然,这仅在将项目输出选择为安装程序的基础时才可能。否则,您需要手动将文件添加到安装程序中。要执行更精确的操作,需要了解用于构建MSI文件的安装程序是什么。有关更多信息,请参见使用Windows Installer部署VSTO解决方案

在处理安装程序时,您可以将VSTO插件视为常规的基于.NET的应用程序。

英文:

It depends on the installer chosen for publishing the add-in. Basically you have two possible ways:

  1. ClickOnce - see How to: Specify which files are published by ClickOnce and How to: Include a data file in a ClickOnce application.
  2. MSI - if you set the Built Action property to the Content value the file should be added automatically to the installer. Of course, that is possible only if the project output was chosen as the base for the installer. Otherwise, you need to add a file to the installer manually. For more precise actions need to know what installer is used for building the MSI file. See Deploying a VSTO Solution Using Windows Installer for more information.

You can treat your VSTO add-in as a regular .net based application when you are dealing with installers.

huangapple
  • 本文由 发表于 2023年5月25日 07:14:37
  • 转载请务必保留本文链接:https://go.coder-hub.com/76327944.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定