简体   繁体   English

如何将查询字符串参数传递给VSTO ClickOnce应用程序?

[英]How can I pass query string parameters to VSTO ClickOnce application?

I've been working on an Outlook VSTO AddIn using VS 2015. I noticed that the publish options are different for the VSTO ClickOnce deployment than they are for a regular application deployed via ClickOnce. 我一直在使用VS 2015开发Outlook VSTO加载项。我注意到VSTO ClickOnce部署的发布选项与通过ClickOnce部署的常规应用程序的发布选项不同。 Specifically, I need to be able to allow URL parameters to be passed to the application, and this option is not available in the VSTO publish options. 具体来说,我需要能够将URL参数传递给应用程序,并且该选项在VSTO的发布选项中不可用。

I have tried using MageUI to enable URL parameters to be passed, but it always results in me getting computed hash errors, even if I set the MageUI preferences to use SHA256 (which is what the signing certificate uses). 我尝试使用MageUI启用传递URL参数的方法,但是即使我将MageUI首选项设置为使用SHA256(这是签名证书所使用的),它也总是导致计算出的哈希错误。

If I just publish with VS 2015 and avoid using MageUI, the deployment can be installed, but obviously it doesn't receive any query string parameters from the deployment URL. 如果我只是使用VS 2015发布,而避免使用MageUI,则可以安装部署,但是显然它不会从部署URL接收任何查询字符串参数。

I'm at my wits' end on this, and I could really use some help. 我为此付出了很多努力,我真的可以使用一些帮助。 I've spent days searching Google and SO specifically, but I haven't found any solutions that address the problem of getting URL parameters passed to the ClickOnce deployed VSTO. 我已经花了几天时间专门搜索Google和SO,但是还没有找到解决将URL参数传递给已部署的VSTO的ClickOnce的问题的解决方案。 Thank you in advance! 先感谢您!

Check out this article on How to pass arguments to an offline ClickOnce application . 查看有关如何将参数传递给脱机ClickOnce应用程序的文章

You can pass parameters to an application using query parameters: 您可以使用查询参数将参数传递给应用程序:

  • System.Diagnostics.Process.Start(shortcutPath, argsToPass);

This is how you read the argument string: 这是您读取参数字符串的方式:

  • //Get the ActivationArguments from the SetupInformation property of the domain. string[] activationData = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData;

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

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