Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3399900
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:49:38+00:00 2026-05-18T04:49:38+00:00

My application is only for me and co-workers, so I don’t care if it’s

  • 0

My application is only for me and co-workers, so I don’t care if it’s Click-Once or copy-the-exe. I want to be able to click a file with given extension in windows explorer and have my program launch and open that file. I can’t get it to capture the file name.

Ostensible solution:

Link

The code I’m trying is below and at this point all I’m trying to do is put the name of the clicked file in a text box. I suspect my relevant ignorance is about how to reference the click-once application from windows explorer. When I build I end up with a file called setup.exe, a file called Wis.application, and when I click on "setup" to install it, I end up with a shortcut of type "Click-once application reference" in "C:\Users\ptom\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Wis". I’ve tried associating files with that shortcut created by install, and associating files with setup.exe. When I click on the file, the application launches but indicates that
AppDomain.CurrentDomain.SetupInformation.ActivationArguments is null. (By "indicates" I mean the text box gets filled in with the text from where I test to see if it’s null). If I run the app from debug, or just by running it from the start menu, it does what I’d expect, following the code path that indicates that ActivationArguments is not null, but that its ActivationData (string[]) is of length 0.

Here is the code from app.xaml.cs

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;

namespace Wis
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {

            // Check if this was launched by double-clicking a doc. If so, use that as the

            // startup file name.
            if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments == null)
            {
                this.Properties["DoubleClickedFileToLoad"] = "There were no activation arguments AGAIN";
            }
            else
            {
                if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData != null
                                   && AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData.Length > 0)
                {
                    this.Properties["DoubleClickedFileToLoad"] =
                    AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData[0];
                }
                else
                {
                    this.Properties["DoubleClickedFileToLoad"] = "Type in a file name";
                }
            }


        }
    }
}
            

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:49:39+00:00Added an answer on May 18, 2026 at 4:49 am

    First of all you should add file assoc for ClickOnce-publish (Select Project->Properties->Publish-Options->File Associations)

    Then add Reference to “System.Deployment”

    Then you could extract path in App.cs in such a manner, depending on type of startup (ClickOnce or Local)

        protected override void OnStartup(System.Windows.StartupEventArgs e)
        {
            var path = GetPath (e);
        }        
    
        private static string GetPath(StartupEventArgs e)
        {
            if (!ApplicationDeployment.IsNetworkDeployed)
                return e.Args.Length != 0 ? e.Args[0] : null;
            if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments == null)
                return null;
            var args = AppDomain.CurrentDomain.SetupInformation.ActivationArguments.ActivationData;
            return args == null || args.Length == 0 ? null : new Uri(args[0]).LocalPath;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want certain functions in my application to only be accessible if the current
I have a UINavigationBar based application - only a one navigation bar that is
The simple curve in this application only appears when it's dragged off the screen,
My web application operates only over SSL and sets a time limited cookie for
My Android Application has only one activity called MainActivity . When I press the
If I have an application with only a few event handlers registered (and the
I have a wordpress application thats currently the only application on the domain. Now
Suppose I have a GUI-only application that runs on Windows and I'd like to
The notification bar in my application shows only the small icon in the ticker
is web-inf/lib should contain only application specific jar's or deployment environment specific jar's also

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.