【问题标题】:Passing parameters to wpf clickonce application deployed on filestore (not web) from another application从另一个应用程序将参数传递给部署在文件存储(而不是 Web)上的 wpf clickonce 应用程序
【发布时间】:2019-06-11 23:05:49
【问题描述】:

我在将参数从一个 WPF 应用程序传递到另一个应用程序时遇到问题。 我正在尝试将其作为带有参数(字符串)的新进程启动,但没有传递任何内容。

这是我尝试过的: AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData 为空。

ApplicationDevelopment.CurrentDevelopment.ActivationUri.Query 为空

Environment.GetCommandLineArguments 给了我应用程序的路径

我正在像这样启动应用程序: System.Diagnostics.Process.Start(filepath, "argumentTest");

这两个应用程序都部署为单击一次,在第二个发布选项中,我选中了“允许将 URL 参数传递给应用程序”

【问题讨论】:

    标签: c# wpf clickonce


    【解决方案1】:

    我正在像这样启动应用程序:System.Diagnostics.Process.Start(filepath, "argumentTest");

    filePath 应参考建议的快捷方式here

    StringBuilder sb = new StringBuilder();
    sb.Append(Environment.GetFolderPath(Environment.SpecialFolder.Programs));
    sb.Append("\\");
    sb.Append("WpfApplicationClickOnce"); //pubslisher name
    sb.Append("\\");
    sb.Append("WpfApplicationClickOnce.appref-ms "); //application name
    string shortcutPath = sb.ToString();
    
    Process.Start(shortcutPath, "argumentTest");
    

    然后您应该能够使用AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData 检索数据。

    【讨论】:

    • 好吧,我会试试这个,但是有没有办法让一个未安装在计算机上的应用程序。如果它像仅在线发布一样发布?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-02-03
    • 1970-01-01
    • 2013-10-18
    • 2011-06-03
    • 2010-09-30
    • 1970-01-01
    • 2020-02-07
    相关资源
    最近更新 更多