简体   繁体   English

从VSTO插件读取自定义文件路径?

[英]Read custom file path from VSTO plugin?

I have an excel plugin where I want to read an xml file on form load from a config folder, but I can't figure out how to read from that folder after I deploy the application. 我有一个excel插件,我想在其中从config文件夹读取表单加载时的xml文件,但是在部署应用程序后我无法弄清楚如何从该文件夹读取。

On the excel ribbon, when the user clicks a button to open my plugin, on form load, I want to read from a specified directory. 在excel功能区上,当用户单击按钮以打开我的插件时,在表单加载时,我想从指定目录中读取。 I am deploying the application with ClickOnce and using VS 2017. I set the xml file build to Content and set Copy to output directory as Always. 我正在使用ClickOnce部署应用程序,并使用VS2017。我将xml文件的版本设置为Content,并将Copy to output directory设置为Always。 When I deploy, it puts the xml file in some ClickOnce dll folder when the user installs it. 部署时,用户安装时会将xml文件放在某个ClickOnce dll文件夹中。

Try InstallDir = Environment.CurrentDirectory; 尝试InstallDir = Environment.CurrentDirectory; at startup of you plugin. 在您启动插件时。

In ThisAddIn_Startup or in your ribbon constructor. ThisAddIn_Startup或功能区构造函数中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM