使用 ClickOnce 注册文件关联

发布于 2024-08-29 17:50:38 字数 79 浏览 2 评论 0原文

我想将文件扩展名与我的 ClickOnce 应用程序关联。 发布选项中有一个文件关联部分,但我无法使其工作。

I want to associate a file extension with my ClickOnce application. There is a File Associations part in the Publish options but I can't manage to make it work.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

人生戏 2024-09-05 17:50:38

您是否在应用程序内添加了代码来处理用户双击文件名并对其执行某些操作时传入的文件名?你的创业公司需要这样的东西。

string fileName = string.Empty;
string[] activationData = 
  AppDomain.CurretnDomain.SetupInformation.ActivationArguments.ActivationData;
if (activationData != null && activationData.Length > 0)
{
    Uri uri = new Uri(activationdata[0]);
    fileName = url.LocalPath.ToString();
}

然后您必须添加代码来对该文件执行某些操作。

Have you added the code inside the application to handle the file name passed in when the user double-clicks on it and do something with it? You need something like this in your startup.

string fileName = string.Empty;
string[] activationData = 
  AppDomain.CurretnDomain.SetupInformation.ActivationArguments.ActivationData;
if (activationData != null && activationData.Length > 0)
{
    Uri uri = new Uri(activationdata[0]);
    fileName = url.LocalPath.ToString();
}

Then you have to add code to do something with the file.

鸠魁 2024-09-05 17:50:38

为了使用文件关联,您的项目必须符合一些规则...

  • 需要完全信任。
  • 必须可以“离线”使用。
  • 必须针对 3.5 框架。

如果您已经在做所有这些事情,那么到底什么不起作用?

In order to use file associations, your project must conform to a few rules...

  • Full Trust is required.
  • Must be available "offline".
  • Must target 3.5 Framework.

If you are already doing all these things, what, exactly, isn't working?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文