[英]VSTO Ribbon Add-in Accessing Resource Files
我正在使用 VB.net 和 Click-once 部署创建功能区加载项。 我有一个包含在包中的 xml 文件(设置为 Content and Copy Always),我正在尝试加载该文件以便在功能区上构建一个 dynamicMenu 项目。 开发期间在我的机器上运行时工作正常; 但是,当ribbon安装在另一台机器上时,找不到要加载的xml文件,菜单是空白的。 根据我在堆栈交换和网络上找到的东西,我尝试了许多不同的方法,但到目前为止我都没有成功。
我敢肯定,这很简单,而且是阻碍办公室部署的最后一件事。
提前致谢
感谢您的回复 - 我似乎偶然发现了一个答案。
System.Deployment.Application.ApplicationDeployment.CurrentDeployment.DataDirectory
似乎提供任何标记为“内容”的数据文件的路径。 它在部署到其他机器时工作。
我找不到使用这条路径的任何已知问题,有人知道我应该知道的任何问题吗?
现有答案对我不起作用,但这确实适用:
//Get the assembly information
System.Reflection.Assembly assemblyInfo = System.Reflection.Assembly.GetExecutingAssembly();
//Location is where the assembly is run from
string assemblyLocation = assemblyInfo.Location;
//CodeBase is the location of the ClickOnce deployment files
Uri uriCodeBase = new Uri(assemblyInfo.CodeBase);
string ClickOnceLocation = Path.GetDirectoryName(uriCodeBase.LocalPath.ToString());
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.